Private counter As Integer
Private Const MaxSize = 10000
Private Color(0 To MaxSize) As Long '保存颜色
Private arrx(1 To MaxSize) As Integer '保存坐标
Private arry(1 To MaxSize) As Integer
Private Sub Command1_Click(Index As Integer)
If Index = 0 Then
CommonDialog1.ShowColor
Picture1.ForeColor = CommonDialog1.Color
Color(counter) = Picture1.ForeColor
Private Sub Form_Paint()
While i > 1 And i <= MaxSize
Picture1.ForeColor = Color(i - 1)
Picture1.Line (arrx(i - 1), arry(i - 1))-(arrx(i), arry(i))
i = i + 1
Wend
End Sub
Private Sub Form_Resize()
Refresh
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'If counter < MaxSize Then
' counter = counter + 1
' arrx(counter) = X: arry(counter) = Y
' Color(counter) = (counter - 1)
' End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If counter < MaxSize Then
counter = counter + 1
arrx(counter) = X: arry(counter) = Y
Color(counter) = Color(counter - 1)
If counter > 1 And Button = vbLeftButton Then
Picture1.Line (arrx(counter - 1), arry(counter - 1))-(arrx(counter), arry(counter))
End If