;Autor: Konne EnableExplicit Define EventID #BCM_FIRST = $1600 #BCM_SETIMAGELIST = #BCM_FIRST + 2 #BUTTON_IMAGELIST_ALIGN_LEFT = 0 Structure BUTTON_IMAGELIST himl.l margin.RECT uAlign.l EndStructure InitCommonControls_() If OpenLibrary(1,"comctl32.dll") Prototype ImageList_AddIcon(List,Icon) Global ImageList_AddIcon.ImageList_AddIcon ImageList_AddIcon=GetFunction(1,"ImageList_AddIcon") CloseLibrary(1) EndIf Procedure AddIconToButton(ButtonID,IconID,w=16,h=16) Protected buttonImgList.BUTTON_IMAGELIST Protected himlIcons himlIcons = ImageList_Create_(w,h, #ILC_MASK |#ILC_COLOR32, 1, 0) ImageList_AddIcon(himlIcons, IconID) With buttonImgList \uAlign = #BUTTON_IMAGELIST_ALIGN_LEFT \margin\top = 3 \margin\bottom = 3 \margin\left = 3 \margin\right = 3 \himl = himlIcons EndWith SendMessage_(ButtonID, #BCM_SETIMAGELIST, 0, buttonImgList) EndProcedure If OpenWindow(0,0,0,500,400,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) CheckBoxGadget(1,10,10,100,40,"Button",0) AddIconToButton(GadgetID(1),LoadIcon_(0,#IDI_APPLICATION),32,32);oder ImageID(#Icon) Repeat EventID=WaitWindowEvent() If EventID = #PB_Event_CloseWindow End EndIf ForEver EndIf