Click here to Skip to main content
6,595,854 members and growing! (21,754 online)
Email Password   helpLost your password?
Multimedia » GDI+ » General     Intermediate

A Simple VB.NET Freehand Drawing method

By John Buettner

The code uses a System.Drawing.Drawing2D.GraphicsPath method to follow the users mouse movements. The path is then painted in the control.
VB.NET 1.0, Win2K, WinXP, Win2003, Dev
Posted:26 Jul 2003
Views:84,398
Bookmarked:17 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
19 votes for this article.
Popularity: 4.48 Rating: 3.50 out of 5
3 votes, 15.8%
1

2
3 votes, 15.8%
3
4 votes, 21.1%
4
9 votes, 47.4%
5

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


Member

Location: United States United States

Other popular GDI+ articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 15 of 15 (Total in Forum: 15) (Refresh)FirstPrevNext
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  
GeneralHow I erase ? Pinmemberdemon.kiler11:44 7 Jun '07  
GeneralRe: 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  
GeneralHow can I save content of PictureBox Pinmemberdragondrache5:55 19 Oct '04  
GeneralRe: 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  
GeneralInk Object PinmemberNick Seng17:03 27 Jul '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 26 Jul 2003
Editor: Nishant Sivakumar
Copyright 2003 by John Buettner
Everything else Copyright © CodeProject, 1999-2009
Web17 | Advertise on the Code Project