Creates an Icon control for the GUI.
GUICtrlCreateIcon ( filename, iconName, left, top [, width [, height [, style = -1 [, exStyle = -1]]]] )
filename | filename of the icon to be loaded. |
iconName | Icon name if the file contains multiple icons. Can be an ordinal name if negative number. Otherwise -1. |
left | The left side of the control. If -1 is used then left will be computed according to GUICoordMode. |
top | The top of the control. If -1 is used then top will be computed according to GUICoordMode. |
width | [optional] The width of the control (default is 32). |
height | [optional] The height of the control (default is 32). |
style | [optional] Defines the style of the control. See GUI Control Styles Appendix. default ( -1) : $SS_NOTIFY forced styles : $WS_TABSTOP, $SS_ICON |
exStyle | [optional] Defines the extended style of the control. See Extended Style Table. |
Success: | the identifier (controlID) of the new control. |
Failure: | 0. |
To set or change information in the control see GUICtrlUpdate...() functions.
To update the icon after the dialog box is displayed use GUICtrlSetImage()
iconName can reference the icon group number. Use a resource hacker to find the correct value.
To combine styles with the default style use BitOR($GUI_SS_DEFAULT_ICON, newstyle, ... ).
To use the values specified above you must #include <StaticConstants.au3> in your script.
Default resizing is $GUI_DOCKSIZE.
Passing a positive number will reference the string equivalent icon name.
Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers.
GUICoordMode (Option), GUICtrlSetImage, GUICtrlUpdate..., GUIGetMsg
#include <GUIConstantsEx.au3>
Example()
Func Example()
GUICreate(" My GUI Icons", 250, 250)
GUICtrlCreateIcon("shell32.dll", 10, 20, 20)
GUICtrlCreateIcon(@ScriptDir & '\Extras\horse.ani', -1, 20, 40, 32, 32)
GUICtrlCreateIcon("shell32.dll", 7, 20, 75, 32, 32)
GUISetState(@SW_SHOW)
; Loop until the user exits.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>Example
Example()
Func Example()
Local $iOldOpt = Opt("GUICoordMode", 1)
GUICreate("My GUI icon Race", 350, 74, -1, -1)
GUICtrlCreateLabel("", 331, 0, 1, 74, 5)
Local $idIcon_1 = GUICtrlCreateIcon(@ScriptDir & '\Extras\dinosaur.ani', -1, 0, 0, 32, 32)
Local $idIcon_2 = GUICtrlCreateIcon(@ScriptDir & '\Extras\horse.ani', -1, 0, 40, 32, 32)
GUISetState(@SW_SHOW)
Local $a = 0
Local $b = 0
While ($a < 300) And ($b < 300)
$a = $a + Int(Random(0, 1) + 0.5)
$b = $b + Int(Random(0, 1) + 0.5)
GUICtrlSetPos($idIcon_1, $a, 0)
GUICtrlSetPos($idIcon_2, $b, 40)
Sleep(10)
WEnd
Sleep(3000)
Opt("GUICoordMode", $iOldOpt)
EndFunc ;==>Example