Code : Tout sélectionner
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)
If CreateImage(0, CX_CMark, CY_CMark)
If StartDrawing(ImageOutput())
Box(0,0,CX_CMark,CY_CMark,GetSysColor_(#COLOR_MENU))
Circle(CX_CMark/2,CY_CMark/2,CX_CMark/3,GetSysColor_(#COLOR_MENUTEXT))
StopDrawing()
EndIf
EndIf
If CreateImage(1, CX_CMark, CY_CMark)
If StartDrawing(ImageOutput())
Box(0,0,CX_CMark,CY_CMark,GetSysColor_(#COLOR_MENU))
Circle(CX_CMark/2,CY_CMark/2,CX_CMark/3,RGB(0,0,255))
StopDrawing()
EndIf
EndIf
If CreateImage(2, CX_CMark, CY_CMark)
If StartDrawing(ImageOutput())
Box(0,0,CX_CMark,CY_CMark,GetSysColor_(#COLOR_MENU))
Circle(CX_CMark/2,CY_CMark/2,CX_CMark/3,RGB(255,0,0))
StopDrawing()
EndIf
EndIf
hMenu=CreateMenu(0, hwnd) : If hMenu
MenuTitle("Datei")
MenuItem(1, "Test")
OpenSubMenu("SubMenu 1")
MenuItem(2, "Sub1\Item1")
CloseSubMenu()
MenuItem(3,"Test 2")
MenuTitle("Bearbeiten")
MenuItem(4,"Ausschneiden")
MenuItem(5,"Kopieren")
MenuItem(6,"Einfgen")
;SetMenuItemBitmaps_(Menu, x, #MF_BYCOMMAND, bitmap1, bitmap2)
;menu: handle du menu
;x: id de la commande
;bitmap1:handle du bitmap UnChecked (affichage par défaut)
;bitmap1:handle du bitmap Checked (affichage si item coché)
SetMenuItemBitmaps_(hMenu, 1, #MF_BYCOMMAND, UseImage(0), UseImage(0))
SetMenuItemBitmaps_(hMenu, 2, #MF_BYCOMMAND, UseImage(1), UseImage(1))
SetMenuItemBitmaps_(hMenu, 3, #MF_BYCOMMAND, UseImage(2), UseImage(2))
EndIf
Repeat
Event=WaitWindowEvent()
Until Event=#PB_Event_CloseWindow
EndIf
End