为什么 图标改不了 【已解决】
本帖最后由 haodd 于 2010-11-12 23:22 编辑#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 198, 192, 114)
$Icon1 = GUICtrlCreateIcon("d:\我的文档\桌面\ico dll\icon_5.dll", -144, 48, 40, 32, 32)
$Button1 = GUICtrlCreateButton("sd", 48, 136, 75, 25)
$Button2 = GUICtrlCreateButton("ds", 144, 136, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Icon1 = GUICtrlCreateIcon("d:\我的文档\桌面\ico dll\icon_5.dll", -144, 48, 40, 32, 32)
Case $Button2
$Icon1 = GUICtrlCreateIcon("d:\我的文档\桌面\ico dll\icon_5.dll", -152, 48, 40, 32, 32)
EndSwitch
WEnd
;"d:\我的文档\桌面\ico dll\icon_5.dll", -144 是个图标 为绿色√
;"d:\我的文档\桌面\ico dll\icon_5.dll", -152 是个图标 为红色的×可是执行的时候 点击 Button2 “红叉”还是√
需要点击两次Button2 “红叉” 才变 “×” 对dll不是太理解 本帖最后由 ivanpg 于 2010-8-29 21:37 编辑
用这个GUICtrlSetImage函数试下#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 198, 192, 114)
$Icon1 = GUICtrlCreateIcon("d:\我的文档\桌面\ico dll\icon_5.dll", -1, 48, 40, 32, 32)
$Button1 = GUICtrlCreateButton("sd", 48, 136, 75, 25)
$Button2 = GUICtrlCreateButton("ds", 144, 136, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Icon11 = GUICtrlSetImage($Icon1, "d:\我的文档\桌面\ico dll\icon_5.dll",-1)
Case $Button2
$Icon11 = GUICtrlSetImage($Icon1, "d:\我的文档\桌面\ico dll\icon_5.dll",-2)
EndSwitch
WEnd
;"d:\我的文档\桌面\ico dll\icon_5.dll", -144 是个图标 为绿色√
;"d:\我的文档\桌面\ico dll\icon_5.dll", -152 是个图标 为红色的× 多加一次负值操作就可以了
{:face (245):}#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 198, 192, 114)
$Icon1 = GUICtrlCreateIcon("d:\我的文档\桌面\ico dll\icon_5.dll", -144, 48, 40, 32, 32)
$Button1 = GUICtrlCreateButton("sd", 48, 136, 75, 25)
$Button2 = GUICtrlCreateButton("ds", 144, 136, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Icon1 = GUICtrlCreateIcon("d:\我的文档\桌面\ico dll\icon_5.dll", -144, 48, 40, 32, 32)
$Icon1 = GUICtrlCreateIcon("d:\我的文档\桌面\ico dll\icon_5.dll", -144, 48, 40, 32, 32)
Case $Button2
$Icon1 = GUICtrlCreateIcon("d:\我的文档\桌面\ico dll\icon_5.dll", -152, 48, 40, 32, 32)
$Icon1 = GUICtrlCreateIcon("d:\我的文档\桌面\ico dll\icon_5.dll", -152, 48, 40, 32, 32)
EndSwitch
WEnd
;"d:\我的文档\桌面\ico dll\icon_5.dll", -144 是个图标 为绿色√
;"d:\我的文档\桌面\ico dll\icon_5.dll", -152 是个图标 为红色的× 还是GUICtrlSetImage好,不推荐反复生成新组件
页:
[1]