鼠标移出效果,求助![已解决]
本帖最后由 duyan 于 2011-4-10 22:00 编辑#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 400, 400)
$bj = 1
Local $Button
GUISetState()
For $p2 = 0 To 4
$Button[$p2] = GUICtrlCreatePic( $p2 & ".jpg", 164, 70 * $p2 + 20, 64, 64)
Next
$Over = -1
While 1
$ID = GUIGetCursorInfo()
For $p2 = 0 To 4
If Not @error Then
If $ID = $Button[$p2] And $bj = 1 Then
GUICtrlSetImage($Button[$p2], "8.jpg")
$bj = 0
ElseIf $ID <> $Button[$p2] And $bj = 0 Then
GUICtrlSetImage($Button[$p2], $p2 & ".jpg")
$bj = 1
EndIf
EndIf
Next
$nMsg = GUIGetMsg(1)
Switch $nMsg
Case -3
Exit
EndSwitch
WEnd
运行后,可以实现鼠标悬停时,图片变换,但是鼠标移出后却变不回来,请教是哪错了。谢谢! 回复 1# duyan
$bj不能只设一个
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 400, 400)
Local $Button,$bj
GUISetState()
For $p2 = 0 To 4
$Button[$p2] = GUICtrlCreatePic( $p2 & ".jpg", 164, 70 * $p2 + 20, 64, 64)
Next
$Over = -1
While 1
$ID = GUIGetCursorInfo()
For $p2 = 0 To 4
If $ID = $Button[$p2] And $bj[$p2] = 0 Then
GUICtrlSetImage($Button[$p2], "8.jpg")
$bj[$p2] = 1
ElseIf $ID <> $Button[$p2] And $bj[$p2] = 1 Then
GUICtrlSetImage($Button[$p2], $p2 & ".jpg")
$bj[$p2] = 0
EndIf
Next
$nMsg = GUIGetMsg(1)
Switch $nMsg
Case -3
Exit
EndSwitch
WEnd 谢谢楼上的赐教! 学习一下,学习一下
页:
[1]