[Implemented] Toolbar with big icons (since 2006)
Posted: Wed Jun 22, 2016 9:40 am
PBsians need toolbar with big icons please.
Thanx.
M.
Thanx.
Code: Select all
;--> toolbar with big icons, a wish since 2006
; WINDOWS ONLY: It works with XP 32bits SP3 ! ! ! ;it should not, but it works anyway !
Enumeration
#MainForm
#ToolBar
EndEnumeration
If OpenWindow(#MainForm, 0, 0, 500, 250, "Toolbar Big Icons", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
;Size of icons
IconSize = 32
;Few images
ico0 = ExtractIcon_(0, "shell32.dll", 43) ;star
ico1 = ExtractIcon_(0, "shell32.dll", 44) ;key
ico2 = ExtractIcon_(0, "shell32.dll", 45) ;folder
ico3 = ExtractIcon_(0, "shell32.dll", 47) ;Cadena
ico4 = ExtractIcon_(0, "shell32.dll", 23) ;question mark
;My own icon with tranparency
hFont = LoadFont(0, "Wingdings", 17)
CreateImage(0, 32, 32,32, #PB_Image_Transparent )
StartDrawing(ImageOutput(0))
;Draw under the text
DrawingMode(#PB_2DDrawing_Outlined| #PB_2DDrawing_AlphaBlend)
Box(0, 0, 32, 32,RGBA(255, 0, 0, 64))
;Draw Text
FrontColor(RGBA(50, 200, 50,200))
;BackColor(RGBA(0, 0, 0, 0))
DrawingFont(hFont)
DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
DrawText(0,0,Chr(42))
;Other method, for memory
; DrawingMode(#PB_2DDrawing_AlphaBlend)
; DrawText(0, 0, Chr(42), RGBA(255, 0, 255, 255), RGBA(0, 0, 0, 0))
;Draw over the text
DrawingMode( #PB_2DDrawing_AlphaBlend)
LineXY(-1, 32, 32, -1, RGBA(255, 0, 0, 128))
StopDrawing()
;Toolbar
If CreateToolBar(#ToolBar, WindowID(#MainForm))
;Retrieving the list of toolbar images
;https://msdn.microsoft.com/en-us/library/windows/desktop/bb787337(v=vs.85).aspx
ImageList = SendMessage_(ToolBarID(#ToolBar), #TB_GETIMAGELIST,0,0)
;New size
ImageList_SetIconSize_(ImageList, IconSize, IconSize)
;Sends the list of toolbar images
SendMessage_(ToolBarID(#ToolBar), #TB_SETIMAGELIST, 0, ImageList)
;For memory
;SendMessage_(ToolBarID(#ToolBar), #TB_SETBITMAPSIZE, 0, 32|32<<16) ; width|height<<16
SendMessage_(ToolBarID(#ToolBar), #TB_SETBUTTONSIZE, 0, 56|32<<16) ; if you want buttons larger than icons
;Auto Resize of the Tool Bar
SendMessage_(ToolBarID(#ToolBar), #TB_AUTOSIZE, 0, 0)
;Add buttons
ToolBarImageButton(1, ico0)
ToolBarImageButton(2, ico1)
ToolBarImageButton(3, ico2)
ToolBarImageButton(4, ico3)
ToolBarImageButton(5, ico4)
ToolBarImageButton(6, ImageID(0))
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf