Sets the bitmap or icon image to use for a control.
GUICtrlSetImage ( controlID, filename [, iconname [, icontype]] )
Parameters
| controlID | The control identifier (controlID) as returned by a GUICtrlCreate... function. |
| filename | The filename containing the picture to be display on the control. |
| iconname | [optional] Icon name if the file contain multiple icon. Can be an ordinal name if negative number. Otherwise -1. |
| icontype | [optional] To select a specific icon size : 0 = small, 1 = normal (default). for a TreeViewItem the icon size : 2 = selected, 4 for non-selected item. |
Return Value
| Success: | Returns 1. |
| Failure: | Returns 0. |
Remarks
Use a resource hacker to know the value of the valid icon name in a file.
Related
GUICtrlCreatePic, GUICtrlCreateIcon, GUICtrlCreateButton, GUICtrlCreateCheckbox
Example
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $msg
GUICreate("My GUI") ; will create a dialog box that when displayed is centered
GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 22)
GUISetState()
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
EndFunc ;==>Example