I have update some of my old code this morning. If it can be useful for someone.
Regards
Guimauve
Code: Select all
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : SetToolBarIconSize
; File : SetToolBarIconSize.pb
; File Version : 1.0.0
; Programmation : OK
; Programmed by : Guimauve
; Date : 04-06-2006
; Last Update : 04-06-2006
; Coded for PureBasic V4.00
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#TB_SETIMAGELIST = 1072
#TB_GETIMAGELIST = 1073
Macro SetToolBarIconSize(ToolBar, IconSize)
SendMessage_(ToolBarID(ToolBar), #TB_SETBITMAPSIZE, 0, (IconSize << 16) + IconSize)
ImageList_SetIconSize_(SendMessage_(ToolBarID(ToolBar), #TB_GETIMAGELIST, 0, 0) , IconSize , IconSize)
SendMessage_(ToolBarID(ToolBar), #TB_AUTOSIZE, 0, 0)
EndMacro
Enumeration
#Fenetre
#Menu
#BarreOutil
#TBtn_Alpha
#TBtn_Beta
EndEnumeration
If OpenWindow(#Fenetre, 0, 0, 400, 300, "SetToolBarIconSize", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateMenu(#Menu, WindowID(#Fenetre))
MenuTitle("File")
MenuItem(1, "Open" +Chr(9)+"Ctrl+O")
MenuItem(2, "Save" +Chr(9)+"Ctrl+S")
MenuItem(3, "Save as"+Chr(9)+"F12")
MenuItem(4, "Quit" +Chr(9)+"Alt+F4")
EndIf
IconSize = 48
If CreateToolBar(#BarreOutil, WindowID(#Fenetre))
SetToolBarIconSize(#BarreOutil, IconSize)
If CreateImage(#TBtn_Alpha,IconSize,IconSize)
StartDrawing(ImageOutput(#TBtn_Alpha));>
Box(0,0,IconSize,IconSize,RGB(255,255,255))
Box(4,4,IconSize-8, IconSize-8,RGB(255,0,0))
StopDrawing();<
EndIf
If CreateImage(#TBtn_Beta,IconSize,IconSize)
StartDrawing(ImageOutput(#TBtn_Beta));>
Box(0,0,IconSize,IconSize,RGB(0,255,0))
Box(4,4,IconSize-8,IconSize-8,RGB(125,255,125))
StopDrawing();<
EndIf
ToolBarImageButton(#TBtn_Alpha , ImageID(#TBtn_Alpha))
ToolBarSeparator()
ToolBarImageButton(#TBtn_Beta , ImageID(#TBtn_Beta))
EndIf
Repeat
EventID = WindowEvent()
Select EventID
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until EventID = #PB_Event_CloseWindow
EndIf
End
; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<