473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Freeform drawing as in MSPaint and Paint.Net

Hi there.
I'd like to allow the user to create some free-form drawing in my
application, in the style of Microsoft Paint (the Brush tool) or Paint.Net.
I've looked through Paint.Net's source code, but could not quite understand
it... :$
So.. what should I do? are there any tutorials?
I've got some code working, but this codes creates a non continuous line and
is kind of slow..
My code is

If desenhar = False Then Exit Sub

Static x As Integer

Static y As Integer

Me.Text = x & " " & e.X & " " & y & " " & e.Y

If e.Button = MouseButtons.Left Then

Dim caneta As New Pen(Color.Gold, 5)

Dim Imagem As Image = Me.PBoxShow.Image

Dim G As Graphics = Graphics.FromImage(imagem)

g.DrawLine(caneta, x, y, e.X, e.Y)

Me.Text = x & " " & e.X & " " & y & " " & e.Y

PBoxShow.Image = imagem

ElseIf e.Button = MouseButtons.Right Then

Dim caneta As New Pen(Color.Navy, 5)

Dim Imagem As Image = Me.PBoxShow.Image

Dim G As Graphics = Graphics.FromImage(imagem)

g.DrawLine(caneta, x, y, e.X, e.Y)

PBoxShow.Image = imagem

End If

x = e.X

y = e.Y

End Sub

Thank you in advance!
Nov 21 '05 #1
1 2551
Here's a few aricles that show you how to build an application like you want:

http://www.vb-helper.com/howto_net_scribble.html

http://www.codeproject.com/vb/net/Freehand_Drawing.asp
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jeroen Ceuppens | last post by:
Hi, When I draw a bitmap on a form, the bitmapdrawing disappears when I move the form, how is it possible to lock the drawing so it stays visible when you move or do somethings else.... Thx...
4
by: Stuart Norris | last post by:
Dear Readers, I am attempting to draw box around some text using unicode on multiline label. The label is forty characters wide and 12 lines deep. I have been trying to draw a box around text...
4
by: Peter Oliphant | last post by:
There doesn't seem to be any documentation on how to create and/or use an instance of System::Drawing::Graphics. On-line MSDN talks about this class, and says: " The Graphics class provides...
2
by: Carl | last post by:
I'm new to C#, and I have only limited programming experience. I've been doing the video tutorials at MS's website, and they're very helpful, but I decided to experiment with GDI+ and have gotten...
11
by: cty0000 | last post by:
I have some quiestion... I want to draw line,point,rectangles and etc... on the from So I code like this.. public update() { g = this.CreateGraphics(); g.FillRectangle(Brushes.White, x1,...
4
by: RobinS | last post by:
I am drawing a rectangle on a picture that has already been drawn on the graphics area (a user control). It works something like this: //in the MouseDown event m_isDragging = true; m_oldX =...
4
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've windows form, in this form i've a panel. I want to draw lines inside the panel using the panel coordinates( meaing that the left upper corner of the panel is 0,0), how can i do it? ...
3
by: MLH | last post by:
What's the best way to launch MSPAINT c:\image.bmp from a VBA procedure. Seeking the route with the least number of complications. Hopefully there will be no more complications than if I clicked...
0
by: jackbenimble999 | last post by:
Hello! I am trying to make my MSAccess work with jpg files. I use hyperlinks to the file and currently the file will open in Paint. But when I click for the next JPG, then a NEW copy of PAINT...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.