#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <GuiImageList.au3>
Local $btn1Text, $btn1, $btn2Text, $btn2, $btn3Text, $btn3
GUICreate("软件安装器", 400, 400)
$hImage = _GUIImageList_Create(32, 32, 5, 3, 6)
_GUIImageList_AddIcon($hImage, "2345_k503106_haozip.exe", 0, True)
$btn1 = GUICtrlCreateButton("", 0, 0, 40, 40)
_GUICtrlButton_SetImageList($btn1, _GetImageListHandle("2345_k503106_haozip.exe", 0, True), 4)
_GUIImageList_AddIcon($hImage, "2345_k503106_haozip.exe", 0, True)
$btn2 = GUICtrlCreateButton("", 40, 0, 40, 40)
_GUICtrlButton_SetImageList($btn2, _GetImageListHandle("2345_k503106_haozip.exe", 0, True), 4)
_GUIImageList_AddIcon($hImage, "2345_k503106_haozip.exe", 0, True)
$btn3 = GUICtrlCreateButton("", 80, 0, 40, 40)
_GUICtrlButton_SetImageList($btn3, _GetImageListHandle("2345_k503106_haozip.exe", 0, True), 4)
GUISetState()
GUICtrlSetTip($btn1, "好压")
GUICtrlSetTip($btn2, "好压")
GUICtrlSetTip($btn3, "好压")
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn1
$btn1Text = _GUICtrlButton_GetText($btn1)
If $btn1Text = "安装" Then
_GUICtrlButton_SetText($btn1, "")
_GUICtrlButton_SetState($btn1)
EndIf
If $btn1Text = "" Then _GUICtrlButton_SetText($btn1, "安装")
Case $btn2
$btn2Text = _GUICtrlButton_GetText($btn2)
If $btn2Text = "安装" Then
_GUICtrlButton_SetText($btn2, "")
_GUICtrlButton_SetState($btn2)
EndIf
If $btn2Text = "" Then _GUICtrlButton_SetText($btn2, "安装")
Case $btn3
$btn3Text = _GUICtrlButton_GetText($btn3)
If $btn3Text = "安装" Then
_GUICtrlButton_SetText($btn3, "")
_GUICtrlButton_SetState($btn3)
EndIf
If $btn3Text = "" Then _GUICtrlButton_SetText($btn3, "安装")
EndSwitch
WEnd
; 使用图像列表在按钮上设置一个图像并显示文本
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
目的:本人想制作一款软件自动安装器,过程中点击某个图标按钮显示安装,再点击即不显示安装。请问以上代码如何修正?谢谢!