PanelGadget height
Posted: Thu Dec 07, 2023 11:14 am
Hi, How to change the size of PanelGadget icon and font size for the tab title (not the content)
http://www.purebasic.com
https://www.purebasic.fr/english/

Code: Select all
ilw = 40
hnd1 = ExtractIcon_(0,"Shell32.dll",$55)
hnd2 = ExtractIcon_(0,"Shell32.dll",$82)
il = ImageList_Create_(ilw,ilw,#ILC_COLOR32 ,2,10)
ImageList_AddIcon_(il,hnd1)
ImageList_AddIcon_(il,hnd2)
LoadFont(0,"Broadway",12)
OpenWindow(0,0,0,320,240,"",$CF0001)
StartDrawing(WindowOutput(0))
DrawingFont(FontID(0))
sp = TextWidth(" ")
StopDrawing()
trim$ = Space(ilw/sp+1)
PanelGadget(0,10,10,300,220)
SetGadgetFont(0,FontID(0))
SetWindowLongPtr_( GadgetID(0), #GWL_STYLE, GetWindowLongPtr_( GadgetID(0), #GWL_STYLE )|#TCS_FIXEDWIDTH )
SendMessage_( GadgetID(0), #TCM_SETITEMSIZE, 0, 140|40<<16)
SendMessage_(GadgetID(0),#TCM_SETIMAGELIST,0,il)
AddGadgetItem(0,0,trim$+"Tab 0")
AddGadgetItem(0,1,trim$+"Tab 1")
TC.TC_ITEM
tC\mask = #TCIF_IMAGE
tc\iImage = 0
SendMessage_(GadgetID(0),#TCM_SETITEM, 0, @TC)
tc\iImage = 1
SendMessage_(GadgetID(0),#TCM_SETITEM, 1, @TC)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
Code: Select all
DestroyIcon_(hnd1)
DestroyIcon_(hnd2)
ImageList_Destroy_(il)Remarks
When it is no longer needed, you must destroy the icon handle returned by ExtractIcon by calling the DestroyIcon function.