VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Paints into a picture box like on paint!

by Deano Splamoni (15 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 31st July 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Paints into a picture box like on paint!

API Declarations


'set pic.autoredraw to true
'set pic.drawwidth to 2

Rate Paints into a picture box like on paint!




Private Sub Form_Load()
down = False      'mouseButton is down
End Sub

Private Sub pic_DblClick()
pic.Cls           'Clears the picture
End Sub

Private Sub pic_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
down = True            'The mouse button is down so down = true
pic.PSet (X, Y)        'Draws a pixel where clicked
End Sub

Private Sub pic_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If down = True Then pic.Line -(X, Y)        'Draws a line from the last place to the next

'NOTE: Use line in mouseMove and not pset, as pset will give
'      you losts of dots where as line will not!
End Sub

Private Sub pic_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
down = False        'MouseButtons is lifted
End Sub


Download this snippet    Add to My Saved Code

Paints into a picture box like on paint! Comments

No comments have been posted about Paints into a picture box like on paint!. Why not be the first to post a comment about Paints into a picture box like on paint!.

Post your comment

Subject:
Message:
0/1000 characters