Ich habe ein Problem mit SetMenuItemBitmaps_(). Mit Popup Menus funktioniert es:
Code: Alles auswählen
hWnd=OpenWindow(0, 0, 0, 300, 200, #PB_Window_SystemMenu|#PB_Window_ScreenCentered, "Menu")
If hWnd
CX_CMark=GetSystemMetrics_(#SM_CXMENUCHECK)
CY_CMark=GetSystemMetrics_(#SM_CYMENUCHECK)
CreateImage(0, CX_CMark, CY_CMark)
StartDrawing(ImageOutput())
Box(2, 2, 5, 5, $0000FF)
StopDrawing()
hMenu=CreatePopupMenu(0) : If hMenu
MenuItem(0, "Test")
SetMenuItemBitmaps_(hMenu, 0, #MF_BYPOSITION, ImageID(), ImageID())
EndIf
Repeat
Event=WaitWindowEvent()
If Event=#WM_RBUTTONDOWN
DisplayPopupMenu(0, hWnd)
EndIf
Until Event=#PB_Event_CloseWindow
EndIf
End
Code: Alles auswählen
hWnd=OpenWindow(0, 0, 0, 300, 200, #PB_Window_SystemMenu|#PB_Window_ScreenCentered, "Menu")
If hWnd
CX_CMark=GetSystemMetrics_(#SM_CXMENUCHECK)
CY_CMark=GetSystemMetrics_(#SM_CYMENUCHECK)
CreateImage(0, CX_CMark, CY_CMark)
StartDrawing(ImageOutput())
Box(2, 2, 5, 5, $0000FF)
StopDrawing()
hMenu=CreateMenu(0, hWnd) : If hMenu
MenuTitle("Datei")
MenuItem(0, "Test")
SetMenuItemBitmaps_(hMenu, 0, #MF_BYPOSITION, ImageID(), ImageID())
EndIf
Repeat
Event=WaitWindowEvent()
Until Event=#PB_Event_CloseWindow
EndIf
End