Change font size of gadgets
Change font size of gadgets
How I can change the font size only? I can reset the default gadget font for all gadgets. But I do not want to change the default font of the operating system (I don't know which font is used), only the size...
- RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: Change font size of gadgets
Code: Select all
EnableExplicit
Define NONCLIENTMETRICS.NONCLIENTMETRICS
NONCLIENTMETRICS\cbSize = SizeOf(NONCLIENTMETRICS)
SystemParametersInfo_(#SPI_GETNONCLIENTMETRICS, 0, NONCLIENTMETRICS, 0)
LoadFont(1, PeekS(@NONCLIENTMETRICS\lfCaptionFont\lfFaceName[0]), 20)
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetGadgetFont(#PB_Default, FontID(1))
ButtonGadget(1, 10, 10, 100, 30, "Button")
TextGadget(2, 10, 50, 100, 30, "Hello")
CheckBoxGadget(3, 10, 100, 100, 30, "Checkbox")
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
EndSelect
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
Re: Change font size of gadgets
Windows only
Code: Select all
LoadFont(0, "MS Shell Dlg", 8)
SetGadgetFont(#PB_Default, FontID(0))
OpenWindow(0, 0, 0, 320, 200, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 100, 30, "Button")
TextGadget(1, 10, 50, 100, 30, "Hello")
CheckBoxGadget(2, 10, 100, 100, 30, "Checkbox")
While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
Code: Select all
GetObject_(GetStockObject_(#DEFAULT_GUI_FONT), SizeOf(LOGFONT), @lf.LOGFONT)
Debug PeekS(@lf\lfFaceName[0])
Et cetera is my worst enemy
Re: Change font size of gadgets
Code: Select all
FID = GetGadgetFont(#PB_Default)
fnt.LOGFONT
GetObject_(FID,SizeOf(fnt),@fnt)
FName$ = PeekS(@fnt\lfFaceName[0])
LoadFont(0,Fname$,18)
SetGadgetFont(#PB_Default,FontID(0))
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(1, 10, 10, 100, 30, "Button")
TextGadget(2, 10, 50, 100, 30, "Hello")
CheckBoxGadget(3, 10, 100, 140, 30, "Checkbox")
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
EndSelect
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
Egypt my love
Re: Change font size of gadgets
Thanks, it seems there is no solution with PB possible, only for Windows with API functions...