Page 1 of 1

Locating the current 'window close' icon

Posted: Mon Jul 20, 2009 12:21 pm
by RichardL
Hi,

For stylistic reasons I would like to re-use the window close icon (The 'X' at top right of a Window()) that is in current use. Can anyone advise me how to locate it?

Thanks

RichardL

Posted: Mon Jul 20, 2009 12:48 pm
by gnozal
I am not sure there is an available icon, I believe M$ uses the Marlett font : http://support.microsoft.com/kb/134861 .

Code: Select all

If OpenWindow(0, 452, 199, 259, 263, "Marlett", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
  ButtonGadget(0, 80, 110, 30, 30, "r")
  ButtonGadget(1, 115, 110, 30, 30, "1")
  ButtonGadget(2, 150, 110, 30, 30, "2")
  SetGadgetFont(0, LoadFont(0, "Marlett", 16, 272))
  SetGadgetFont(1, LoadFont(1, "Marlett", 16, 272))
  SetGadgetFont(2, LoadFont(2, "Marlett", 16, 272))
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        CloseWindow(0)
        Break
    EndSelect
  ForEver
EndIf
This font is available on every windows version : http://www.microsoft.com/typography/fon ... x?FMID=146 (Marlett.ttf is usually a hidden file).

Posted: Mon Jul 20, 2009 2:37 pm
by Fluid Byte
With and without skins:

Code: Select all

OpenWindow(0,0,0,320,240,"void",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)

SetRect_(frc.RECT,20,20,46,46)

hdc = StartDrawing(WindowOutput(0))
; Windows 2000 and lower
SetTextAlign_(hdc,0)
DrawFrameControl_(hdc,frc,#DFC_CAPTION,#DFCS_CAPTIONCLOSE)

; Windows XP and higher
lpBuffer = AllocateMemory(13)
PokeS(lpBuffer,"Window",-1,#PB_Unicode) 

hTheme = OpenThemeData_(WindowID(0),lpBuffer)
OffsetRect_(frc,0,50)
DrawThemeBackground_(hTheme,hdc,18,1,frc,0)
OffsetRect_(frc,40,0)
DrawThemeBackground_(hTheme,hdc,18,2,frc,0)
OffsetRect_(frc,40,0)
DrawThemeBackground_(hTheme,hdc,18,3,frc,0)
CloseThemeData_(hTheme)
StopDrawing()

While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend

Posted: Mon Jul 20, 2009 8:14 pm
by RichardL
Gentlemen,

Thank you both, very much, for your solutions to my problem. :D

RichardL