HighTechTalks DotNet Forums  

Drawing 101.

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss Drawing 101. in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Rob Brooks
 
Posts: n/a

Default Drawing 101. - 09-29-2005 , 10:21 AM






Hi,

I'm going some drawing via "Graphics" in a "Paint" callback and the commands
will only manifest themselves if I minimise the window and then maximise it
again.

I'm new to windows programming and so I am obviously missing a lot of the
basics when it comes to this sort of thing but my mandate is to get a
utility up and running ASAP.

What's the magic function call I'm missing?

Many thanks,

R.

private void PictureBox_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{

Graphics graphics = e.Graphics;

System.Drawing.Pen pen = new Pen( System.Drawing.Color.White );

graphics.DrawPath( pen, graphicsPath1 );

}




Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Drawing 101. - 09-29-2005 , 11:51 AM






What's in your graphics path?

Try starting out simple, e.g.:

System.Drawing.Pen pen = new Pen( System.Drawing.Color.White );
e.Graphics.DrawLine(pen, 0, 0, 100, 100);
pen.Dispose();


It's best to dispose drawing resources right away.


Reply With Quote
  #3  
Old   
José Manuel Agüero
 
Posts: n/a

Default Re: Drawing 101. - 09-29-2005 , 02:24 PM



Hello Rob,

The PictureBox only executes the Paint event when its window receives a Paint event.
You can force it to redraw whenever you want by calling the method PictureBox.Refresh().
By the way, I don't recommend you to call PictureBox.Refresh() in the PictureBox.Paint event.

Regards.


"Rob Brooks" <robnotthisbitbrooks (AT) btinternet (DOT) com> escribió en el mensaje news:TDT_e.6640$so3.895 (AT) fe06 (DOT) news.easynews.com...
Quote:
Hi,

I'm going some drawing via "Graphics" in a "Paint" callback and the commands
will only manifest themselves if I minimise the window and then maximise it
again.

I'm new to windows programming and so I am obviously missing a lot of the
basics when it comes to this sort of thing but my mandate is to get a
utility up and running ASAP.

What's the magic function call I'm missing?

Many thanks,

R.

private void PictureBox_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{

Graphics graphics = e.Graphics;

System.Drawing.Pen pen = new Pen( System.Drawing.Color.White );

graphics.DrawPath( pen, graphicsPath1 );

}


Reply With Quote
  #4  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: Drawing 101. - 09-29-2005 , 02:35 PM



Hi Rob,
I think you'll find a wealth of information on my site. I provide the GDI+
FAQ, Windows Froms Tips and Tricks and a Beginners Guide to GDI+.

I strongly suggest that you search there before asking here because many of
may answers are "Refer to the GDI+ FAQ" :-))

If there's any issues that you run across not covered there please feel free
to post here. There are a whole bunch of knowlegable people who can help
out.

--
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.





"Rob Brooks" <robnotthisbitbrooks (AT) btinternet (DOT) com> wrote

Quote:
Hi,

I'm going some drawing via "Graphics" in a "Paint" callback and the
commands
will only manifest themselves if I minimise the window and then maximise
it
again.

I'm new to windows programming and so I am obviously missing a lot of the
basics when it comes to this sort of thing but my mandate is to get a
utility up and running ASAP.

What's the magic function call I'm missing?

Many thanks,

R.

private void PictureBox_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{

Graphics graphics = e.Graphics;

System.Drawing.Pen pen = new Pen( System.Drawing.Color.White );

graphics.DrawPath( pen, graphicsPath1 );

}






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.