Click here to Skip to main content
Licence 
First Posted 26 Jul 2003
Views 111,520
Downloads 960
Bookmarked 27 times

A Simple VB.NET Freehand Drawing method

By John Buettner | 26 Jul 2003
The code uses a System.Drawing.Drawing2D.GraphicsPath method to follow the users mouse movements. The path is then painted in the control.
3 votes, 14.3%
1

2
3 votes, 14.3%
3
4 votes, 19.0%
4
11 votes, 52.4%
5
4.40/5 - 21 votes
3 removed
μ 3.94, σa 2.53 [?]

Sample Image - Freehand_Drawing.jpg

Introduction

This is a simple freehand drawing example for VB.NET. I was frustrated at not finding a simple way to draw on a control or a picture in VB.NET. What was a simple task in VB6, seemed to take hundreds of lines of code in .NET sample code. Hopefully this will give other VB.NET programmers ideas on a simple implementation of this type of code.

The code uses a System.Drawing.Drawing2D.GraphicsPath method to follow the users mouse movements. The path is then painted in the control.

Background

Ideas for this code came from the Microsoft "Scribble" sample code, Christian Graus's excellent article on a C++ code called "Doodle" and the Microsoft website.

Note that this is a VERY pedantic freehand drawing code, so be kind in you comments. :)

History

  • Written July, 2003

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

John Buettner



United States United States

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionCan you do this for a web page? Pinmemberhaherrera7:05 9 Sep '11  
QuestionThank you PinmemberSergey Chepurin3:04 4 Jul '11  
GeneralThanks John this is awesome Pinmemberaltenh8:19 3 Dec '10  
GeneralThanks John Pinmemberrahulxlash21:29 27 Aug '09  
Questionhow to add pen width use text box and user change color use botton PinmemberEPPYZA10:07 8 Oct '08  
GeneralSystem.OutOfMemoryException occurred in System.Drawing.dll (converted 2005) Pinmemberyalenap13:23 1 Apr '08  
GeneralRe: System.OutOfMemoryException occurred in System.Drawing.dll (converted 2005) Pinmemberjkkghjhjgh19:12 25 Mar '10  
QuestionHow I erase ? Pinmemberdemon.kiler11:44 7 Jun '07  
AnswerRe: How I erase ? Pinmemberamit122719:39 21 Jun '07  
GeneralRe: How I erase ? PinmemberRichard_Faulkner13:54 21 Aug '07  
GeneralPaint above /on activexcontrol? [modified] Pinmemberturbovulc5:03 31 Jul '06  
QuestionHow can I save content of PictureBox Pinmemberdragondrache5:55 19 Oct '04  
AnswerRe: How can I save content of PictureBox PinmemberNatBest18:53 23 Mar '06  
AnswerRe: How can I save content of PictureBox PinmemberThaSaint3:56 4 Dec '08  
GeneralClear PictureBox1 Pinmemberdragondrache7:50 18 Oct '04  
GeneralRe: Clear PictureBox1 Pinmemberloay454518:32 28 Apr '06  
Generaldrawing color PinmemberPythorian10:51 5 Nov '03  
AnswerRe: drawing color PinmemberMartin Houstrup7:04 19 Apr '09  
GeneralRe: drawing color PinmembershankarBangalore2:43 27 Apr '10  
GeneralRe: drawing color PinmemberMartin Houstrup7:51 27 Apr '10  
GeneralInk Object PinmemberNick Seng17:03 27 Jul '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120210.1 | Last Updated 27 Jul 2003
Article Copyright 2003 by John Buettner
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid