| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 694 人关注过本帖
标题:vb.net 谁能帮我把这个获取鼠标位置的模块给改成.net 的模块啊?谢谢了
取消只看楼主 加入收藏
wxmtgg
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2013-2-17
结帖率:0
收藏
 问题点数:0 回复次数:1 
vb.net 谁能帮我把这个获取鼠标位置的模块给改成.net 的模块啊?谢谢了
模块内容:
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function ReleaseCapture Lib "user32" () As Long

Public Type POINTAPI
    X As Long
    Y As Long
    End Type

Public Function GetX() As Long
    Dim n As POINTAPI
    GetCursorPos n
    GetX = n.X
End Function
'Download by http://www.
Public Function GetY() As Long
    Dim n As POINTAPI
    GetCursorPos n
    GetY = n.Y
End Function

窗体内容:

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim MouseExit As Boolean
    MouseExit = (0 <= X) And (X <= Picture1.Width) And (0 <= Y) And (Y <= Picture1.Height)
    If MouseExit Then
        Label3.Caption = "鼠标进入了图片"
        SetCapture Picture1.hWnd
    Else
        Label3.Caption = "鼠标离开了图片"
        ReleaseCapture
    End If
End Sub

Private Sub Timer1_Timer()
    Dim n As POINTAPI
    GetCursorPos n
    Text1.Text = n.X
    Text2.Text = n.Y
End Sub


求帮我改成语言,谢谢了!
2014-05-16 19:36
wxmtgg
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2013-2-17
收藏
得分:0 
回复 2 楼 油盐酱醋
Dim n As POINTAPI
    GetCursorPos n
    Text1.Text = n.X
    Text2.Text = n.Y

这段用怎么表达啊?
2014-05-17 09:09
快速回复:vb.net 谁能帮我把这个获取鼠标位置的模块给改成.net 的模块啊?谢谢了 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017465 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved