; ----------------------------------------------- #include #include #include ; ----------------------------------------------- Local $hGUI = GUICreate("Button Image Test", 345, 65) ; The width and height of the dialog box.[1] GUISetFont(12, $FW_BOLD, $GUI_FONTNORMAL, "Calibri") ; The size and the type of font being employed. [2] Local $MyButton = GUICtrlCreateButton("", 20, 20, 150, 25, $BS_BITMAP) ; The postion, size and the GUI Control Styles of the button. [3] GUICtrlSetImage($MyButton, "my_image.bmp") ; The actual image [4] Local $Exit = GUICtrlCreateButton("Exit Me Please!", 175, 20, 150, 25) ; As $MyButton, but with no image. ; ----------------------------------------------- GUISetState(@SW_SHOW, $hGUI) ; Display the dialog box ; ----------------------------------------------- While 1 ; To "catch" all of the button events Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Exit ExitLoop ; What occurs when the Exit button is selected. Case $MyButton MyFunc() ; I simply wanted something to occur when $MyButton is selected. EndSwitch WEnd ; ----------------------------------------------- Func MyFunc() ; In response to the selection of $MyButton. MsgBox(0, 'MyButton', 'Inside MyFunc()') EndFunc ;==>MyFunc ; ----------------------------------------------- ; Observations ; [1] this dialog displays what I refer to as a 1x2 button dialog...that is, 1 button high by two buttons wide! ; [2] I do tend to prefer the Calibri font for all of my button texts. ; [3] Go to the HelpFile and locate GUICtrlCreateButton. For "style" select "GUI Control Styles Appendix". ; [4] As the image is stored within the folder where the script is located,...no "path" is required.