本帖最后由 cxm23 于 2011-3-22 17:05 编辑
http://www.autoitx.com/forum.php ... =%BD%F8%B6%C8%CC%F5
我修改了afan的图片进度条程序,想实现当鼠标移动或按任意键时进度条就消失的效果,自己写了下,效果不理想,其中鼠标要在窗口上移动才产生事件,键盘则全无反应,不知问题出在哪?请各位帮忙看下
还有一个问题,就是要使一开始鼠标就在GUI窗口里,就算没移动,也产生了事件?#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Dim $s = 5
$Form1 = GUICreate("Form1", 472,289,0,0)
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\背景.jpg", 1, 279, 470, 10)
$Picjd0 = GUICtrlCreatePic(@ScriptDir & "\进度0.jpg", 5, 280, 4, 6)
$Picjd1 = GUICtrlCreatePic(@ScriptDir & "\进度1.jpg", 2 + 4, 280, 1, 6)
$Picjd2 = GUICtrlCreatePic(@ScriptDir & "\进度2.jpg", 2 + 3, 280, 4, 6)
GUISetState(@SW_SHOW)
;~ Sleep(500)
AdlibRegister("myadlib", 20)
GUIRegisterMsg ($WM_KEYDOWN, "WM_KEYDOWN" )
GUIRegisterMsg ($WM_MOUSEMOVE, "WM_MOUSEMOVE" )
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
EndSwitch
WEnd
Func myadlib()
ControlMove("", "", $Picjd1, Default, Default, 1 + $s, 6)
ControlMove("", "", $Picjd2, 2 + 3 + $s, 280)
$s += 1
If $s >= 458 Then
AdlibUnRegister()
GUICtrlDelete($Pic1)
GUICtrlDelete($Picjd0)
GUICtrlDelete($Picjd1)
GUICtrlDelete($Picjd2)
EndIf
EndFunc ;==>myadlib
Func WM_MOUSEMOVE()
;~ MsgBox(1,"dd","dd")
AdlibUnRegister()
GUICtrlDelete($Pic1)
GUICtrlDelete($Picjd0)
GUICtrlDelete($Picjd1)
GUICtrlDelete($Picjd2)
EndFunc
Func WM_KEYDOWN()
AdlibUnRegister()
GUICtrlDelete($Pic1)
GUICtrlDelete($Picjd0)
GUICtrlDelete($Picjd1)
GUICtrlDelete($Picjd2)
EndFunc
|