Verknüpft eine Imagelist zu einem Button-Control
#Include <GuiButton.au3>
_GUICtrlButton_SetImageList($hWnd, $hImage[, $nAlign = 0[, $iLeft = 1[, $iTop = 1[, $iRight = 1[, $iBottom = 1]]]]])
Parameter
| $hWnd | Handle zu dem Control |
| $hImage | Handle der Imagelist. Sollte entweder ein einzelnes Bild, welches für alle Status verwendet wird oder ein individuelles Bild für jeden Status enthalten: 1 - Normal 2 - Hot 3 - Gedrückt 4 - deaktiviert 5 - Standard 6 - Stylus Hot (nur tablet Computer) |
| $nAlign | [optional] Legt die zu verwendende Ausrichtung fest. Dieser Parameter kann einer der folgenden Werte sein: 0 - Ausrichtung des Bildes am linken Rand. 1 - Ausrichtung des Bildes am rechten Rand. 2 - Ausrichtung des Bildes am oberen Rand. 3 - Ausrichtung des Bildes am unteren Rand. 4 - Bild zentriert. |
| $iLeft | [optional] Linker Rand des Icons |
| $iTop | [optional] Oberer Rand des Icons |
| $iRight | [optional] Rechter Rand des Icons |
| $iBottom | [optional] Unterer Rand des Icons |
Rückgabewert
| Erfolg: | True |
| Fehler: | False |
Bemerkungen
Mindestvoraussetzung Betriebssystem: Windows XP.
Verwandte Funktionen
_GUICtrlButton_GetImageList
Siehe auch
Suche in der MSDN Bibliothek nach BCM_SETIMAGELIST
Beispiel
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
Opt("MustDeclareVars", 1)
_Main()
Func _Main()
Local $hImage, $y = 70, $iIcon = 125, $btn[6], $rdo[6], $chk[6], $hImageSmall
GUICreate("Buttons", 510, 400)
GUISetState()
$hImage = _GUIImageList_Create(32, 32, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImage, "shell32.dll", $x, True)
Next
$hImageSmall = _GUIImageList_Create(16, 16, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImageSmall, "shell32.dll", $x)
Next
$btn[0] = GUICtrlCreateButton("Button 1", 10, 10, 90, 50)
_GUICtrlButton_SetImageList($btn[0], $hImage)
$rdo[0] = GUICtrlCreateRadio("Radiobutton 1", 120, 10, 120, 25)
_GUICtrlButton_SetImageList($rdo[0], $hImageSmall)
$chk[0] = GUICtrlCreateCheckbox("Check Button 1", 260, 10, 120, 25)
_GUICtrlButton_SetImageList($chk[0], $hImageSmall)
For $x = 1 To 5
$btn[$x] = GUICtrlCreateButton("Button " & $x + 1, 10, $y, 90, 55)
_GUICtrlButton_SetImageList($btn[$x], _GetImageListHandle("shell32.dll", $iIcon + $x, True), $x)
$rdo[$x] = GUICtrlCreateRadio("Radiobutton " & $x + 1, 120, $y, 120, 35)
_GUICtrlButton_SetImageList($rdo[$x], _GetImageListHandle("shell32.dll", $iIcon + $x), $x)
$chk[$x] = GUICtrlCreateCheckbox("Check Button " & $x + 1, 260, $y, 120, 35)
_GUICtrlButton_SetImageList($chk[$x], _GetImageListHandle("shell32.dll", $iIcon + $x), $x)
$y += 60
Next
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
Exit
EndFunc ;==>_Main
; Verwendet die Imagelist um ein Bild zu setzen und Text auf den Buttons darzustellen
Func _GetImageListHandle($sFile, $nIconID = 0, $fLarge = False)
Local $iSize = 16
If $fLarge Then $iSize = 32
Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3)
If StringUpper(StringMid($sFile, StringLen($sFile) - 2)) = "BMP" Then
_GUIImageList_AddBitmap($hImage, $sFile)
Else
_GUIImageList_AddIcon($hImage, $sFile, $nIconID, $fLarge)
EndIf
Return $hImage
EndFunc ;==>_GetImageListHandle