Erzeugt ein Icon-Control für die GUI.
GUICtrlCreateIcon ( filename, iconName, left, top [, width [, height [, style [, exStyle]]]] )
Parameter
| filename | Dateiname des zu platzierenden Icons. |
| iconName | Icon-Name, falls die Datei mehrere Icons enthält. Bei negativer Zahl gilt es als Ordnungszahl. Andernfalls -1. |
| left | Die linke Seite des Icons. Wird -1 verwendet, dann wird left mit Hilfe von GUICoordMode berechnet. |
| top | Die Oberkante des Icons. Wird -1 verwendet, dann wird top mit Hilfe von GUICoordMode berechnet. |
| width | [optional] Die Breite des Icons (Standard sind 32 Pixel). |
| height | [optional] Die Höhe des Icons (Standard sind 32 Pixel). |
| style | [optional] Legt den Stil des Icon-Controls fest. Siehe Anhang GUI-Stile für Controls. Standard ( -1) : $SS_NOTIFY Erzwungene Stile : $WS_TABSTOP, $BS_ICON |
| exStyle | [optional] Legt den erweiterten Stil des Controls fest. Siehe Tabelle der erweiterten Stile. |
Rückgabewert
| Erfolg: | Gibt die Identifikationsnummer (Control-ID) des neuen Controls zurück. |
| Fehler: | Gibt 0 zurück. |
Bemerkungen
Um Informationen im Control zu setzen oder zu verändern, siehe GUICtrlUpdate....
Verwandte Funktionen
GUICoordMode (Option), GUICtrlSetImage, GUICtrlUpdate..., GUIGetMsg
Beispiel
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Example1()
Example2()
; Beispiel 1 ---------------------------
Func Example1()
Local $icon, $n1, $n2, $msg
GUICreate("Meine GUI Icons", 250, 250)
$icon = GUICtrlCreateIcon("shell32.dll", 10, 20, 20)
$n1 = GUICtrlCreateIcon(@WindowsDir & "\cursors\horse.ani", -1, 20, 40, 32, 32)
$n2 = GUICtrlCreateIcon("shell32.dll", 7, 20, 75, 32, 32)
GUISetState()
; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
EndFunc ;==>Example1
; Beispiel 2 ---------------------------
Func Example2()
Local $iOldOpt, $n1, $n2, $a, $b
$iOldOpt = Opt("GUICoordMode", 1)
GUICreate("Mein GUI Icon Rennen", 350, 74, -1, -1)
GUICtrlCreateLabel("", 331, 0, 1, 74, 5)
$n1 = GUICtrlCreateIcon(@WindowsDir & "\cursors\dinosaur.ani", -1, 0, 0, 32, 32)
$n2 = GUICtrlCreateIcon(@WindowsDir & "\cursors\horse.ani", -1, 0, 40, 32, 32)
GUISetState(@SW_SHOW)
Dim $a = 0, $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($n1, $a, 0)
GUICtrlSetPos($n2, $b, 40)
Sleep(20)
WEnd
Sleep(1000)
Opt("GUICoordMode", $iOldOpt)
EndFunc ;==>Example2