Dim sv As Boolean, X1 As Single, Y1 As Single, col As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
if Button=Vbleftbutton then
frm1.PSet (X, Y), col 'ставим точку под курсором
X1 = X
Y1 = Y
sv = True 'Ставим флаг что надо рисовать
end if
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If sv Then ' Если флаг установлен рисуем линию
frm1.Line (X1, Y1)-(X, Y), col 'RGB(k, l, z)
X1 = X
Y1 = Y
End If
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
sv = False 'хватит уже рисовать =)
End Sub
Private Sub Form_Load()
col=RGB(11,56,255) ' Ставим цвет линии
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If sv Then
Me.Cls ' Чистим форму
Form1.Line (X1, Y1)-(X, Y), col 'RGB(k, l, z)
'X1 = X
'Y1 = Y
End If
End Sub
moppuk писал(а):Да и еще...
На форме то все получается. А как только стоит вместо form1_ переименовать на picture1 - то все... В picturebox не работает!!!!
Public intN As Integer
Public intX1 As Integer
Public intY1 As Integer
Public boolDrawing As Boolean
Dim rArr(100, 4) As Integer
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
intX1 = X
intY1 = Y
boolDrawing = True
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If boolDrawing Then
Picture1.Cls
For t = 1 To intN
Picture1.Line (rArr(t, 0), rArr(t, 1))-(rArr(t, 2), rArr(t, 3))
Next t
Picture1.Line (intX1, intY1)-(X, Y)
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
intN = intN + 1
rArr(intN, 0) = intX1
rArr(intN, 1) = intY1
rArr(intN, 2) = X
rArr(intN, 3) = Y
boolDrawing = False
End Sub
Добваить(уровень,сторона)
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 52