[VB程序]在标签中实时显示鼠标的坐标
窗体上有一个名称为Label1的标签,程序运行时,单机鼠标左键,再移动鼠标,鼠标的位置坐标会实时的显示在Label1标签中,单机鼠标右键则停止实时显示,并将标签中内容清除...
窗体上有一个名称为Label1的标签,程序运行时,单机鼠标左键,再移动鼠标,鼠标的位置坐标会实时的显示在Label1标签中,单机鼠标右键则停止实时显示,并将标签中内容清除
展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励20(财富值+成长值)
展开全部
Option Explicit
Private MouseNum As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseNum = Button
If MouseNum = 1 Then
Label1.Visible = True
Else
Label1.Visible = False
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MouseNum = 1 Then
Label1.Caption = "X=" & X & ",Y=" & Y
End If
End Sub
Private MouseNum As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseNum = Button
If MouseNum = 1 Then
Label1.Visible = True
Else
Label1.Visible = False
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MouseNum = 1 Then
Label1.Caption = "X=" & X & ",Y=" & Y
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询