|
Добавьте PictureBox на форму Dim X1 As Integer, X2 As Integer, Y1 As Integer, Y2 As Integer
Dim SelectBox As Boolean
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As
Single)
Picture1.DrawMode = 6
'Draw style to dots
Picture1.DrawStyle = 2
'Check if a Select Box is already drawn
If X2 > 0 Then Picture1.Line (X1, Y1)-(X2, Y2), , B
'Reset all the values to the current point
X1 = X
Y1 = Y
X2 = X
Y2 = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As
Single)
'Проверить, нажата ли левая кнопка мыши
If Button = 1 Then
Picture1.Line (X1, Y1)-(X2, Y2), , B
X2 = X
Y2 = Y
Picture1.Line (X1, Y1)-(X, Y), , B
End If
End Sub
|
|