VB中怎么在Picture中鼠标点击三下连线画出三角形
1个回答
展开全部
Dim x1 As Integer, y1 As Integer, d As Integer
Private Sub Form_Load()
x1 = -1
y1 = -1
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
If x1 = -1 Then
Picture1.PSet (X, Y), vbRed
x1 = X
y1 = Y
Else
Picture1.Line -(X, Y), vbRed
d = d + 1
If d < 2 Then Exit Sub
Picture1.Line (X, Y)-(x1, y1), vbRed
x1 = -1
y1 = -1
d = 0
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询