找回密码
 加入
搜索
查看: 2668|回复: 4

[网络通信] 在按钮上使用自定义鼠标形状(已经解决)

  [复制链接]
发表于 2010-5-12 23:25:31 | 显示全部楼层 |阅读模式
本帖最后由 gto250 于 2010-5-13 06:57 编辑
#Include <GUIConstantsEx.au3>
#Include <WinAPIEx.au3>
#Include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $hForm, $hCursor

;$hCursor = _WinAPI_LoadCursor(0, 32649) ; IDC_HAND
$hCursor = _WinAPI_LoadCursor(_WinAPI_GetModuleHandle(@SystemDir & '\user32.dll'), 116)

$hForm = GUICreate('MyGUI')
GUIRegisterMsg($WM_SETCURSOR, 'WM_SETCURSOR')
GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam)
  Switch $hWnd
    Case $hForm
      _WinAPI_SetCursor($hCursor)
      Return 0
  EndSwitch
  Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SETCURSOR
这段代码可以在GUI界面上改变鼠标形状,但是如果在这个界面上添加一个按钮的话,如果鼠标移动到按钮上,鼠标形状就会变成没有改变前的原始指针状态。
哪位兄弟有办法,能在控件上使用自定义鼠标形状
发表于 2010-5-12 23:39:50 | 显示全部楼层
GUICtrlSetCursor()?
发表于 2010-5-13 03:03:16 | 显示全部楼层
#Include <GUIConstantsEx.au3>
#Include <WinAPIEx.au3>
#Include <WindowsConstants.au3>
Global $hForm, $hCursor

$hForm = GUICreate('在按钮上使用自定义鼠标形状')
GUIRegisterMsg($WM_SETCURSOR, 'WM_SETCURSOR')
$Button1= GUICtrlCreateButton("按钮", 125, 40,125, 40)
GUISetState()
Do
$h = Random(100, 116, 1)
Sleep(50)
$hCursor = _WinAPI_LoadCursor(_WinAPI_GetModuleHandle(@SystemDir & '\user32.dll'), $h)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam)
  Switch $hWnd
    Case $hForm 
      _WinAPI_SetCursor($hCursor)
      Return 1
  EndSwitch
  Return $GUI_RUNDEFMSG
EndFunc
发表于 2010-5-13 09:35:21 | 显示全部楼层

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2010-5-13 13:19:42 | 显示全部楼层
GUICtrlSetCursor(控件ID,指针)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-10 22:24 , Processed in 0.083310 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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