Click here to Skip to main content
Click here to Skip to main content

A Simple VB.NET Freehand Drawing method

, 26 Jul 2003
Rate this:
Please Sign up or sign in to vote.
The code uses a System.Drawing.Drawing2D.GraphicsPath method to follow the users mouse movements. The path is then painted in the control.

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. Smile | :)

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
No Biography provided

Comments and Discussions

 
QuestionVery Nice and Simple PinmemberMember 40329031-Dec-13 8:38 
GeneralVery Nice PinmemberAlan Burkhart18-Sep-12 13:46 
Suggestionthank you Pinmembermedosalah974-Jul-12 11:15 
QuestionThank you so much Pinmembermohammat suyanto20-Jun-12 19:36 
AnswerThanks PinmemberPraveen288628-May-12 20:15 
QuestionCan you do this for a web page? Pinmemberhaherrera9-Sep-11 6:05 
QuestionThank you PinmemberSergey Chepurin4-Jul-11 2:04 
GeneralThanks John this is awesome Pinmemberaltenh3-Dec-10 7:19 
GeneralThanks John Pinmemberrahulxlash27-Aug-09 20:29 
Questionhow to add pen width use text box and user change color use botton PinmemberEPPYZA8-Oct-08 9:07 
GeneralSystem.OutOfMemoryException occurred in System.Drawing.dll (converted 2005) Pinmemberyalenap1-Apr-08 12:23 
GeneralRe: System.OutOfMemoryException occurred in System.Drawing.dll (converted 2005) Pinmemberjkkghjhjgh25-Mar-10 18:12 
QuestionHow I erase ? Pinmemberdemon.kiler7-Jun-07 10:44 
AnswerRe: How I erase ? Pinmemberamit122721-Jun-07 18:39 
GeneralRe: How I erase ? PinmemberRichard_Faulkner21-Aug-07 12:54 
GeneralPaint above /on activexcontrol? [modified] Pinmemberturbovulc31-Jul-06 4:03 
QuestionHow can I save content of PictureBox Pinmemberdragondrache19-Oct-04 4:55 
AnswerRe: How can I save content of PictureBox PinmemberNatBest23-Mar-06 17:53 
AnswerRe: How can I save content of PictureBox PinmemberThaSaint4-Dec-08 2:56 
GeneralClear PictureBox1 Pinmemberdragondrache18-Oct-04 6:50 
GeneralRe: Clear PictureBox1 Pinmemberloay454528-Apr-06 17:32 
Generaldrawing color PinmemberPythorian5-Nov-03 9:51 
AnswerRe: drawing color PinmemberMartin Houstrup19-Apr-09 6:04 
GeneralRe: drawing color PinmembershankarBangalore27-Apr-10 1:43 
GeneralRe: drawing color PinmemberMartin Houstrup27-Apr-10 6:51 

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.

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