找回密码
 加入
搜索
查看: 2090|回复: 3

[AU3基础] 鼠标移出效果,求助![已解决]

[复制链接]
发表于 2011-4-8 22:30:40 | 显示全部楼层 |阅读模式
本帖最后由 duyan 于 2011-4-10 22:00 编辑
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 400, 400)
$bj = 1
Local $Button[5]
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[4] = $Button[$p2] And $bj = 1 Then
                        GUICtrlSetImage($Button[$p2], "8.jpg")
                        $bj = 0
                ElseIf $ID[4] <> $Button[$p2] And $bj = 0 Then
                        GUICtrlSetImage($Button[$p2], $p2 & ".jpg")
                        $bj = 1
                EndIf
                        EndIf
                        Next
        $nMsg = GUIGetMsg(1)
        Switch $nMsg[0]
                Case -3
                        Exit
        EndSwitch
WEnd
运行后,可以实现鼠标悬停时,图片变换,但是鼠标移出后却变不回来,请教是哪错了。谢谢!
发表于 2011-4-8 23:01:30 | 显示全部楼层
回复 1# duyan


    $bj不能只设一个
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 400, 400)
Local $Button[5],$bj[5]
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[4] = $Button[$p2] And $bj[$p2] = 0 Then
                                GUICtrlSetImage($Button[$p2], "8.jpg")
                                $bj[$p2] = 1
                        ElseIf $ID[4] <> $Button[$p2] And $bj[$p2] = 1 Then
                                GUICtrlSetImage($Button[$p2], $p2 & ".jpg")
                                $bj[$p2] = 0
                        EndIf
                Next
                $nMsg = GUIGetMsg(1)
        Switch $nMsg[0]
                Case -3
                        Exit
        EndSwitch
WEnd
 楼主| 发表于 2011-4-8 23:51:52 | 显示全部楼层
谢谢楼上的赐教!
发表于 2011-4-9 07:44:57 | 显示全部楼层
学习一下,学习一下
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-2 08:41 , Processed in 0.071706 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表