Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base

Post new topic   Reply to topic
Freehand Drawing
View previous topic :: View next topic  
Author Message
Gregers
Newbie


Joined: 01 Feb 2004
Posts: 5

PostPosted: Feb 12th, 2004 09:11 AM    Post subject: Freehand Drawing Reply with quote

The Code below lets you draw whils't the left mouse button is depressed. You will need to add a redraw event to let it be visible when printed using the printform method.

Code:
Dim DrawNow As Boolean

Private Sub Form_MouseDown(Button As Integer, _
      Shift As Integer, X As Single, Y As Single)
   If Button = vbLeftButton Then
      DrawNow = True
      CurrentX = X
      CurrentY = Y
   ElseIf Button = vbRightButton Then
      Line -(X, Y)
   End If
End Sub

Private Sub Form_MouseMove(Button As Integer, _
      Shift As Integer, X As Single, Y As Single)
   If DrawNow Then Line -(X, Y)
End Sub

Private Sub Form_MouseDown(Button As Integer, _
      Shift As Integer, X As Single, Y As Single)
   If Button = vbLeftButton Then
      DrawNow = True
      CurrentX = X
      CurrentY = Y
   ElseIf Button = vbRightButton Then
      Line -(X, Y)
   End If
End Sub

Private Sub Form_MouseDown(Button As Integer, _
      Shift As Integer, X As Single, Y As Single)
   If Button = vbLeftButton Then
      DrawNow = True
      CurrentX = X
      CurrentY = Y
   ElseIf Button = vbRightButton Then
      Line -(X, Y)
   End If
End Sub

Private Sub Form_MouseMove(Button As Integer, _
      Shift As Integer, X As Single, Y As Single)
   If DrawNow Then Line -(X, Y)
End Sub
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic