1个回答
展开全部
像楼上说的那样 用时钟 获取鼠标位置 然后将鼠标直接赋值给窗口的坐标 代码: Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long '先调用GetCursorPos函数,用来获取鼠标坐标的 Private Type POINTAPI x As Long y As Long End Type Dim pos As POINTAPI Private Sub Form_Load() Timer1.Interval = 10 End Sub Private Sub Timer1_Timer() GetCursorPos pos Form1.Top = pos.y * Screen.TwipsPerPixelY '直接将获取的鼠标坐标通过TIMER控件实时赋给窗口坐标 Form1.Left = pos.x * Screen.TwipsPerPixelX End Sub 望采纳。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询