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 广告
作为东莞市大凡光学科技有限公司的一员,我们深知Matlab圆点标定板在相机标定中的重要性。该标定板通过均匀分布的圆点,帮助精确计算相机参数,优化成像效果。Matlab强大的编程功能,使得我们能够灵活设计标定板,调整圆点大小、数量和分布,以满...
点击进入详情页
本回答由东莞大凡提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询