Code: Select all
MyImage.l = LoadImage(#PB_Any, "~/myimage.png")
MenuItem(1, "Open", MyImage.l)
If I am way off base or missing something, please let me know. Or if you agree with me, please reply below.
Code: Select all
MyImage.l = LoadImage(#PB_Any, "~/myimage.png")
MenuItem(1, "Open", MyImage.l)
Code: Select all
Global Current
Procedure MenuItemEx(MenuItemID, Text$, MemoryAddress)
Current = MenuItemID
MenuItem(MenuItemID, Text$)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
If MemoryAddress <> 0
myBitmap = CatchImage(#PB_Any, MemoryAddress)
myBitmap = ResizeImage(myBitmap, GetSystemMetrics_(#SM_CXMENUCHECK), GetSystemMetrics_(#SM_CYMENUCHECK), #PB_Image_Smooth)
SetMenuItemBitmaps_(MenuID(), MenuItemID, 0, myBitmap, myBitmap)
EndIf
CompilerEndIf
EndProcedure
OpenWindow(0, 150, 150, 320, 240, #PB_Window_SystemMenu, "PureBasic - Windows BMP Menu")
If CreateMenu(0, WindowID())
MenuTitle("&File")
MenuItemEx( 1, "&Load...", ?IconOpen)
MenuItemEx( 2, "&Save", ?IconSave)
MenuItemEx( 3, "Save &As...", 0)
MenuBar()
MenuItemEx( 4, "&Quit", ?IconQuit)
MenuTitle("&Edit")
OpenSubMenuEx("Basic", ?IconCut)
MenuItemEx( 5, "Cut", ?IconCut)
MenuItemEx( 6, "Copy", ?IconCopy)
MenuItemEx( 7, "Paste", ?IconPaste)
CloseSubMenu()
OpenSubMenu("Font")
MenuItemEx( 8, "Tahoma", 0)
MenuTitle("&Information")
MenuItemEx(11, "&About", ?IconAbout)
EndIf
Repeat
Select WaitWindowEvent()
Case #PB_EventMenu
Select EventMenuID()
Case 11 ;About
MessageRequester("About", "Really Cool Menu Example", 64)
Case 7 ;Quit
Quit = 1
Default
MessageRequester("Info", "MenuItem: "+Str(EventMenuID()), 0)
EndSelect
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
End
IconSave: IncludeBinary "save.bmp"
IconOpen: IncludeBinary "open.bmp"
IconQuit: IncludeBinary "quit.bmp"
IconAbout:IncludeBinary "about.bmp"
IconCut: IncludeBinary "cut.bmp"
IconCopy: IncludeBinary "copy.bmp"
IconPaste:IncludeBinary "paste.bmp"
Are you of all people trying to tell me that this looks acceptable? I cannot beleive thatTrond wrote:Native, not ownerdrawn menu with icons in Windows.![]()
MS Platform SDK wrote:The selected and clear bitmaps should be monochrome. The system uses the Boolean AND operator to combine bitmaps with the menu so that the white part becomes transparent and the black part becomes the menu-item color. If you use color bitmaps, the results may be undesirable.
Code: Select all
I did it for the IDE, and it was a pain to do