Option Explicit
Const Margin As Integer = 10
Const SmallSpace As Integer = 2
Const LargeSpace As Integer = 10
Const MaxColors As Integer = 4
Dim Colors(MaxColors + 1) As Long
Const MaxLineWidths As Integer = 4
Dim LineWidths(MaxLineWidths + 1) As Integer
Private Sub adsads_Click()
picCanvas.Cls
End Sub
Private Sub asd_Click()
End
End Sub
Private Sub asddasdas_Click()
MsgBox "Version 1.0", vbInformation, "Version"
End Sub
Private Sub Command1_Click()
End
End Sub
Private Sub dasdasdas_Click()
MsgBox "Made By Code.7", vbInformation, "About"
End Sub
Private Sub Form_Load()
Dim I As Integer
picCanvas.AutoRedraw = True
picCanvas.BackColor = vbWhite
picCanvas.ToolTipText = "Click the left mouse button to sketch"
cmdClear.ToolTipText = "Click to clear the canvas"
Form1.ScaleMode = vbPixels
CreateColorPalette
CreateLineWidthPalette
lblColor_Click MaxColors
optLineWidth(0).Value = True
optLineWidth_Click 0
End Sub
Private Sub Form_Resize()
picCanvas.Width = Form1.ScaleWidth - picCanvas.Left - Margin
picCanvas.Top = Margin
picCanvas.Height = Form1.ScaleHeight - picCanvas.Top - Margin
cmdClear.Top = Form1.ScaleHeight - cmdClear.Height - Margin
End Sub
Private Sub CreateColorPalette()
Dim I As Integer
Colors(0) = vbYellow
Colors(1) = vbGreen
Colors(2) = vbBlue
Colors(3) = vbRed
Colors(4) = vbBlack
lblColor(0).Left = Margin
lblColor(0).Top = Margin
lblColor(0).ToolTipText = "Click to set the drawing color"
lblColor(0).BackColor = Colors(0)
For I = 1 To MaxColors
Load lblColor(I)
lblColor(I).BackColor = Colors(I)
lblColor(I).Left = Margin
lblColor(I).Top = lblColor(I - 1).Top + lblColor(I - 1).Height
lblColor(I).Visible = True
Next I
End Sub
Private Sub CreateLineWidthPalette()
Dim I As Integer
LineWidths(0) = 1
LineWidths(1) = 2
LineWidths(2) = 4
LineWidths(3) = 7
LineWidths(4) = 10
lblLineWidth(0).ToolTipText = "Click to select a line width"
optLineWidth(0).ToolTipText = lblLineWidth(0).ToolTipText
For I = 0 To MaxLineWidths
If I > 0 Then
Load optLineWidth(I)
Load lblLineWidth(I)
optLineWidth(I).Top = optLineWidth(I - 1).Top + optLineWidth(I - 1).Height + SmallSpace
Else
optLineWidth(I).Top = lblColor(MaxColors).Top + lblColor(MaxColors).Height + LargeSpace
End If
optLineWidth(I).Left = Margin
optLineWidth(I).Visible = True
lblLineWidth(I).Left = Margin
lblLineWidth(I).Height = LineWidths(I)
lblLineWidth(I).Width = lblColor(0).Width
lblLineWidth(I).Top = optLineWidth(I).Top + ((optLineWidth(I).Height - LineWidths(I)) / 2)
lblLineWidth(I).Visible = True
Next I
End Sub
Private Sub lblColor_Click(Index As Integer)
Dim I As Integer
picCanvas.ForeColor = Colors(Index)
For I = 0 To MaxColors
lblColor(I).BorderStyle = 0
Next I
lblColor(Index).BorderStyle = 1
End Sub
Private Sub lblLineWidth_Click(Index As Integer)
picCanvas.DrawWidth = LineWidths(Index)
optLineWidth(Index) = True
End Sub
Private Sub optLineWidth_Click(Index As Integer)
picCanvas.DrawWidth = LineWidths(Index)
End Sub
Private Sub picCanvas_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
picCanvas.Line (X, Y)-(X, Y)
End If
End Sub
Private Sub picCanvas_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
picCanvas.Line -(X, Y)
End If
End Sub
Private Sub cmdClear_Click()
picCanvas.Cls
End Sub
Private Sub saddasasdasd_Click()
MsgBox "Contact Me At
UltimateCode@hotmail.com", vbInformation, "Contact"
End Sub