寻找系统自备的特大反转的鼠标指针方案
答案:2 悬赏:10 手机版
解决时间 2021-02-03 13:38
- 提问者网友:山高云阔
- 2021-02-03 07:34
寻找系统自备的特大反转的鼠标指针方案
最佳答案
- 五星知识达人网友:鱼忧
- 2021-02-03 08:45
控制面板--硬件和声音--设备和打印机--鼠标--指针-------
全部回答
- 1楼网友:酒者煙囻
- 2021-02-03 09:53
呵呵,学习下,基本上我认为很难,但是我有个思路,说出来同楼主研究下,在窗体上画一个图片,图片的样子就是鼠标指针的样子,然后通过鼠标移动事件来写代码。如果鼠标在窗体上移动的话。(x0 y0) 图片就显现出来并移动到坐标 (left=form1.width-x,top=form1.height-y)同是把真正的鼠标给敝屏。(怎么弊屏我真不会)大约就是这个意思。下面有个用按钮代替图片的代码。供你参考一下下,如果楼主你找到方法请贴一下。我也想知道。呵呵
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Label1 = x & ": " & y
Command1.Left = Form1.Width - x
Command1.Top = Form1.Height - y
兄弟啊,为你这个问题我想了一个晚上,突然在半夜睡觉的梦里想出了一个解决方法,今天试了试。成了,呵呵,保证和你的题目是一样的。代码有点多,如果不懂HI我吧。。。
Private 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)
Private Const MOUSEEVENTF_MOVE = &H1 'Mouse move
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long 'move 坐标
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long '移动
Private Type POINTAPI '定义点(Point)结构
x As Long '点在X坐标(横坐标)上的坐标值
y As Long '点在Y坐标(纵坐标)上的坐标值
End Type
Dim fafa1x As Long
Dim fafa1y As Long
Dim fafa2x As Long
Dim fafa2y As Long
Dim fa1 As Boolean
Dim fa2 As Boolean
Private Sub Form_Click()
Timer1.Interval = 2 '设置时钟可以自己调,根据你的移动速度来
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
fa2 = True '是否在窗体上移动
If fa1 = True Then '新坐标
Dim dl As Long
Dim mypoint As POINTAPI
dl& = GetCursorPos(mypoint)
fafa2x = mypoint.x
fafa2y = mypoint.y
SetCursorPos fafa1x + (fafa1x - fafa2x) * 2, fafa1y + (fafa1y - fafa2y) * 2 '反向移动
fa2 = False '防止鼠标跳出窗体后出错
fa1 = False '开始计时器
End If
End Sub
Private Sub Timer1_Timer()
If fa1 = False And fa2 = True Then
Dim dl As Long
Dim mypoint As POINTAPI
dl& = GetCursorPos(mypoint) '调用函数,获取屏幕鼠标坐标
fafa1x = mypoint.x
fafa1y = mypoint.y
fa1 = True '开始读取新坐标
End If
Label1 = mypoint.x & " : " & mypoint.y
End Sub
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Label1 = x & ": " & y
Command1.Left = Form1.Width - x
Command1.Top = Form1.Height - y
兄弟啊,为你这个问题我想了一个晚上,突然在半夜睡觉的梦里想出了一个解决方法,今天试了试。成了,呵呵,保证和你的题目是一样的。代码有点多,如果不懂HI我吧。。。
Private 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)
Private Const MOUSEEVENTF_MOVE = &H1 'Mouse move
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long 'move 坐标
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long '移动
Private Type POINTAPI '定义点(Point)结构
x As Long '点在X坐标(横坐标)上的坐标值
y As Long '点在Y坐标(纵坐标)上的坐标值
End Type
Dim fafa1x As Long
Dim fafa1y As Long
Dim fafa2x As Long
Dim fafa2y As Long
Dim fa1 As Boolean
Dim fa2 As Boolean
Private Sub Form_Click()
Timer1.Interval = 2 '设置时钟可以自己调,根据你的移动速度来
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
fa2 = True '是否在窗体上移动
If fa1 = True Then '新坐标
Dim dl As Long
Dim mypoint As POINTAPI
dl& = GetCursorPos(mypoint)
fafa2x = mypoint.x
fafa2y = mypoint.y
SetCursorPos fafa1x + (fafa1x - fafa2x) * 2, fafa1y + (fafa1y - fafa2y) * 2 '反向移动
fa2 = False '防止鼠标跳出窗体后出错
fa1 = False '开始计时器
End If
End Sub
Private Sub Timer1_Timer()
If fa1 = False And fa2 = True Then
Dim dl As Long
Dim mypoint As POINTAPI
dl& = GetCursorPos(mypoint) '调用函数,获取屏幕鼠标坐标
fafa1x = mypoint.x
fafa1y = mypoint.y
fa1 = True '开始读取新坐标
End If
Label1 = mypoint.x & " : " & mypoint.y
End Sub
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯