vb 怎样使窗口跟随鼠标坐标移动
我想使用以下代码使Form1的Top跟随鼠标的y坐标移动,但是我鼠标都移动到窗口最下面了,Form1的窗口却还没有到最下面?请问是不是还要有什么单位转换之类的?还是应增加...
我想使用以下代码使Form1的Top跟随鼠标的y坐标移动,但是我鼠标都移动到窗口最下面了,Form1的窗口却还没有到最下面?请问是不是还要有什么单位转换之类的?还是应增加什么代码?请大虾们帮帮忙!!不胜感激!
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Dim pos As POINTAPI
Private Sub Timer1_Timer()
GetCursorPos pos
Label1.Caption = pos.x & "," & pos.y
Form1.Top = pos.y
End Sub 展开
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Dim pos As POINTAPI
Private Sub Timer1_Timer()
GetCursorPos pos
Label1.Caption = pos.x & "," & pos.y
Form1.Top = pos.y
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询