simple drawing with a mouse - Diogo |
17-Jun-07 04:14:43
|
I think you should try to create your Graphics instance in pbMouseDown
and dispose it in pbMouseUp |
 |
| |
simple drawing with a mouse - Jeff Gaines |
17-Jun-07 05:01:10
|
On 17/06/2007 in message
What about saving the points in mouse down/mouse up and painting in the
paint event. There is a Scribble sample in the help - it's C++ but may help.
--
Jeff Gaines |
 |
| |
simple drawing with a mouse - Bob Powell [MVP] |
17-Jun-07 05:49:09
|
The art to this is in the correct implementation of the event-driven system.
You should NEVER draw in a mouse move event.
When the mouse goes down, begin accumulating the points at which the mouse
was located.
As the mouse moves, accumulate more points and signal the screen dirty.
As the mouse goes up, store all the points in the sequence and signal the
screen dirty.
In the Paint routine, draw all the point arrays you've stored as a line,
including, if any, the one currently under construcition.
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article. |
 |
| |
simple drawing with a mouse - Jared |
17-Jun-07 06:08:14
|
http://www.microsoft.com/downloads/details.aspx?familyid=84bbefa4-7047-41df-8583-e3bdbf9d805f&displaylang=en |
 |
| |
simple drawing with a mouse - Robbe Morris - MVP C# |
17-Jun-07 08:56:47
|
This has worked relatively well for me.
http://www.eggheadcafe.com/articles/dotnetcompactframework_capture_signature_to_file.asp
--
Robbe Morris
EggHeadCafe.com
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp |
 |
| |
simple drawing with a mouse - KWienhold |
20-Jun-07 05:12:48
|
As a sidenode:
Pen also implements IDisposable, so you should probably dispose you
Pen as well as your Graphics context. |
 |
| |
simple drawing with a mouse - Xishan Shigr |
25-Jun-07 07:12:00
|
Try This Out Man!!!
private System.Drawing.Drawing2D.GraphicsPath mousepath;
private bool Draw = false ;
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (Draw == true)
{
mousepath.AddLine(new Point(e.X, e.Y), new Point(e.X,
e.Y));
Graphics g = this.CreateGraphics();
Pen p = Pens.DarkCyan;
g.DrawPath(p, mousepath);
}
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
mousepath = new System.Drawing.Drawing2D.GraphicsPath();
Point startpoint = new Point(MousePosition.X, MousePosition.Y);
ptOriginal.X = e.X;
ptOriginal.Y = e.Y;
this.Cursor = Cursors.Cross;
Draw = true;
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
Draw = false ;
} |
 |
| |
simple drawing with a mouse - Bob Powell [MVP] |
05-Jul-07 03:58:30
|
I invite you to visit the GDI+ FAQ to discover why this is a horribly
bad example.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article. |
 |
| |