自己想在窗口建个自定义坐标 同时vb 获取鼠标坐标 并显示
5个回答
展开全部
当然可以了,比如你定义窗体坐标为10至-10
程序如下:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Scale (-10, 10)-(10, -10)
Me.Caption = "x坐标:" & X & " Y坐标:" & Y
End Sub
程序如下:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Scale (-10, 10)-(10, -10)
Me.Caption = "x坐标:" & X & " Y坐标:" & Y
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Command1_Click()
Dim p As POINTAPI
GetCursorPos p
MsgBox "x=" & p.x & ", y=" & p.y
End Sub
欢迎进我的QQ群里谈论VB啊:21941971
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Command1_Click()
Dim p As POINTAPI
GetCursorPos p
MsgBox "x=" & p.x & ", y=" & p.y
End Sub
欢迎进我的QQ群里谈论VB啊:21941971
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Scale (-100, 100)-(100, -100)
Me.Caption = "鼠标当前x坐标:" & X & "鼠标当前Y坐标:" & Y
End Sub
Me.Scale (-100, 100)-(100, -100)
Me.Caption = "鼠标当前x坐标:" & X & "鼠标当前Y坐标:" & Y
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Scale (-100, 100)-(100, -100)
Cls
Print "x坐标:" & X & " Y坐标:" & Y
End Sub
Me.Scale (-100, 100)-(100, -100)
Cls
Print "x坐标:" & X & " Y坐标:" & Y
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Option Explicit
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Scale (-100, 100)-(100, -100) '''定义坐标,两点分别是 窗口左上和右下的新左边
Me.Line (-100, 0)-(100, 0)
Me.Line (0, 100)-(0, -100)
lbl1.Caption = "(x:" & X & " y:" & Y & ")"
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Scale (-100, 100)-(100, -100) '''定义坐标,两点分别是 窗口左上和右下的新左边
Me.Line (-100, 0)-(100, 0)
Me.Line (0, 100)-(0, -100)
lbl1.Caption = "(x:" & X & " y:" & Y & ")"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询