VB 如何实现鼠标左键拖动画矩形,并标注主对角线的坐标
2个回答
展开全部
'VB通过拖动鼠标画矩形,并且标注对角坐标
Dim Px As Single
Dim Py As Single
Dim flag As Boolean
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.AutoRedraw = False
Px = X
Py = Y
flag = True
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If flag And Button = vbLeftButton Then
Me.Refresh
Line (Px, Py)-(X, Y), , B
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If flag And Button = vbLeftButton Then
Me.AutoRedraw = True
Line (Px, Py)-(X, Y), , B
flag = False
Me.CurrentX = Px
Me.CurrentY = Py
Print "(" & Px & "," & Py & ")"
Me.CurrentX = X
Me.CurrentY = Y
Print "(" & X & "," & Y & ")"
End If
End Sub
东莞大凡
2024-08-07 广告
2024-08-07 广告
标定板认准大凡光学科技,专业生产研发厂家,专业从事光学影像测量仪,光学投影测量仪.光学三维测量仪,光学二维测量仪,光学二维测量仪,光学三维测量仪,光学二维测量仪.的研发生产销售。东莞市大凡光学科技有限公司创立于 2018 年,公司总部坐落于...
点击进入详情页
本回答由东莞大凡提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询