VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Makes a drawing application similar to paint

by David Smith/Andrew Butnit (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 29th August 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Makes a drawing application similar to paint

API Declarations


Dim drawcol


Rate Makes a drawing application similar to paint



Picture1.Cls
End Sub

Private Sub Form_Load()
drawcol = 12    'use red to start with
mnuBlack.Checked = False
mnuRed.Checked = True
mnuGreen.Checked = False
mnuBlue.Checked = False
mnuWhite.Checked = False
End Sub

Private Sub lblBlack_Click()
Call GoColour(0)  'QBColor(0) is black
End Sub

Private Sub lblBlue_Click()
Call GoColour(9)   'QBColor(9) is light blue
End Sub


Private Sub lblGreen_Click()
Call GoColour(10)    'QBColor(10) is light green
End Sub


Private Sub lblRed_Click()
    Call GoColour(12)
End Sub


Private Sub lblWhite_Click()
Call GoColour(15)    'QBColor(15) is white
End Sub

Private Sub mnuBlack_Click()
    Call GoColour(0)  'QBColor(0) is black
End Sub


Private Sub mnuBlue_Click()
    Call GoColour(9)   'QBColor(9) is light blue
End Sub


Private Sub mnuClearDraw_Click()
    Picture1.Cls
End Sub

Private Sub mnuExit_Click()
End
End Sub


Private Sub mnuGreen_Click()
    Call GoColour(10)    'QBColor(10) is light green
End Sub

Private Sub mnuRed_Click()
    Call GoColour(12)
End Sub

Private Sub mnuWhite_Click()
    Call GoColour(15)    'QBColor(15) is white
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.CurrentX = X
Picture1.CurrentY = Y   'the next line will start here
If Button = 2 Then
    Picture1.Circle (X, Y), 200, QBColor(drawcol)
End If

End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
    Picture1.Line -(X, Y), QBColor(drawcol)
End If

End Sub





Private Sub GoColour(new_colour)
    drawcol = new_colour
    mnuBlack.Checked = (drawcol = 0)
    mnuBlue.Checked = (drawcol = 9)
    mnuGreen.Checked = (drawcol = 10)
    mnuRed.Checked = (drawcol = 12)
    mnuWhite.Checked = (drawcol = 15)
End Sub


Download this snippet    Add to My Saved Code

Makes a drawing application similar to paint Comments

No comments have been posted about Makes a drawing application similar to paint. Why not be the first to post a comment about Makes a drawing application similar to paint.

Post your comment

Subject:
Message:
0/1000 characters