源程序
Dim paint As Boolean
Dim x0 As Integer
Dim y0 As Integer
Private Sub Form_Load()
DrawWidth = 3 '定义画笔大小
ForeColor = RGB(0, 255, 255) '定义画笔颜色
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
paint = True
x0 = X: y0 = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If paint Then
Line (X, Y)-(x0, y0)
x0 = X: y0 = Y
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
paint = flase
End Sub
以下为调色板
Private Sub HScroll1_Change()
Label1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End Sub
Private Sub HScroll2_Change()
Label1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End Sub
Private Sub HScroll3_Change()
Label1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End Sub