Код:
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
Opt("MustDeclareVars", 1)
_Main()
Func _Main()
Local $sBMPNormal = @WindowsDir & "\pchealth\helpctr\System\images\24x24\arrow_green_normal.bmp"
Local $sBMPHot = @WindowsDir & "\pchealth\helpctr\System\images\24x24\arrow_green_mouseover.bmp"
Local $sBMPPress = @WindowsDir & "\pchealth\helpctr\System\images\24x24\arrow_green_mousedown.bmp"
Local $sBMPImage = @WindowsDir & "\pchealth\helpctr\System\blurbs\watermark_300x.bmp"
Local $btn1, $btn2, $btn3, $btn4, $msg
Local $hImagebtn1, $hImagebtn2, $hImagebtn3 ,$hImagebtn4
;Caveat: Minimum Operating Systems: Windows XP.
;Image list with multiple images will only show the images
;other than the 1st image when Themes are used.
Local $hGUI = GUICreate("Button Imagelists - Minimum OS: Windows XP",400,300)
GUICtrlCreatePic(@WindowsDir & "\Web\Wallpaper\Windows XP.jpg", 0, 0, 400, 300)
GUICtrlSetState(-1, $GUI_DISABLE)
;multi state image Bitmap
$btn1 = GUICtrlCreateButton("This Way", 30, 30, 90, 32)
GUICtrlSetTip(-1, "Multi state bitmap imagelist")
$hImagebtn1 = _GUIImageList_Create(24, 24, 5, 5)
_GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);1 - Normal
_GUIImageList_AddBitmap($hImagebtn1, $sBMPHot) ;2 - Hot
_GUIImageList_AddBitmap($hImagebtn1, $sBMPPress) ;3 - Pressed
_GUIImageList_AddBitmap($hImagebtn1, $sBMPPress) ;4 - Disabled
_GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);5 - Defaulted
_GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);6 - Stylus Hot (tablet computers only)
_GUICtrlButton_SetImageList($btn1, $hImagebtn1)
;single state image Bitmap
$btn2 = GUICtrlCreateButton("This Way", 30, 70, 90, 32)
GUICtrlSetTip(-1, "Single bitmap imagelist")
$hImagebtn2 = _GUIImageList_Create(24, 24, 5, 3)
_GUIImageList_AddBitmap($hImagebtn2, $sBMPNormal);1 - Normal
_GUICtrlButton_SetImageList($btn2, $hImagebtn2)
;single state image Icon
$btn3 = GUICtrlCreateButton("Unlock", 30, 110, 90, 40)
GUICtrlSetTip(-1, "Single icon imagelist")
$hImagebtn3 = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon($hImagebtn3, "shell32.dll", 47, True)
_GUICtrlButton_SetImageList($btn3, $hImagebtn3)
;single state image Bitmap with overlayed text
$btn4 = GUICtrlCreateButton("Help", 30, 160, 90, 90)
GUICtrlSetTip(-1, "Single bitmap imagelist with overlayed text")
GUICtrlSetFont(-1, 14, 800, -1, "Comic Sans MS")
$hImagebtn4 = _GUIImageList_Create(80, 80, 5, 3)
_GUIImageList_AddBitmap($hImagebtn4, $sBMPImage)
_GUICtrlButton_SetImageList($btn4, $hImagebtn4, 4)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $btn1
Case $btn2
GUICtrlSetState($btn1, $GUI_DISABLE)
Case $btn3
GUICtrlSetState($btn1, $GUI_ENABLE)
Case $btn4
EndSwitch
WEnd
EndFunc ;==>_Main
|