PC Review


Reply
Thread Tools Rate Thread

drawing takes a few seconds?

 
 
Jeroen Ceuppens
Guest
Posts: n/a
 
      26th Nov 2003
When I draw a bmp, it takes e few seconds before it shows on the screen, is
it because the onpain method is only active after x seconds? What can I
change about the code to let the bmp drawn immediatly?

CODE:
private void button1_Click(object sender, System.EventArgs e)

{

draw=true;

bmp = new Bitmap(@"\\GERONIMO\im\ImageWarpIllum.bmp");

this.Invalidate(new Rectangle(100,100,100,100));

//this.Refresh();

}

protected override void OnPaint(PaintEventArgs e)

{

base.OnPaint(e);


g=this.CreateGraphics();

if (draw)

g.DrawImage(bmp,100,100);

}


 
Reply With Quote
 
 
 
 
Maarten Struys eMVP
Guest
Posts: n/a
 
      26th Nov 2003
Have you tried using this.Update()?

Regards,
Maarten Struys, eMVP
PTS Software bv

>-----Original Message-----
>When I draw a bmp, it takes e few seconds before it

shows on the screen, is
>it because the onpain method is only active after x

seconds? What can I
>change about the code to let the bmp drawn immediatly?
>
>CODE:
>private void button1_Click(object sender,

System.EventArgs e)
>
>{
>
>draw=true;
>
>bmp = new Bitmap(@"\\GERONIMO\im\ImageWarpIllum.bmp");
>
>this.Invalidate(new Rectangle(100,100,100,100));
>
>//this.Refresh();
>
>}
>
>protected override void OnPaint(PaintEventArgs e)
>
>{
>
>base.OnPaint(e);
>
>
>g=this.CreateGraphics();
>
>if (draw)
>
>g.DrawImage(bmp,100,100);
>
>}
>
>
>.
>

 
Reply With Quote
 
Alex Yakhnin [MVP]
Guest
Posts: n/a
 
      26th Nov 2003
Don't create Graphics in the OnPaint event. Use the one
that's passed in the event itself:


protected override void OnPaint(PaintEventArgs e)
{
if (draw)
e.Graphics.DrawImage(bmp,100,100);

base.OnPaint(e);

}

--
Alex Yakhnin, .NET CF MVP
http://www.intelliprog.com
http://www.opennetcf.org

>-----Original Message-----
>When I draw a bmp, it takes e few seconds before it shows

on the screen, is
>it because the onpain method is only active after x

seconds? What can I
>change about the code to let the bmp drawn immediatly?
>
>CODE:
>private void button1_Click(object sender,

System.EventArgs e)
>
>{
>
>draw=true;
>
>bmp = new Bitmap(@"\\GERONIMO\im\ImageWarpIllum.bmp");
>
>this.Invalidate(new Rectangle(100,100,100,100));
>
>//this.Refresh();
>
>}
>
>protected override void OnPaint(PaintEventArgs e)
>
>{
>
>base.OnPaint(e);
>
>
>g=this.CreateGraphics();
>
>if (draw)
>
>g.DrawImage(bmp,100,100);
>
>}
>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access takes 24-35 seconds while SQL Server takes only 2-3 seconds =?Utf-8?B?QXJpZg==?= Microsoft Access VBA Modules 9 4th Mar 2007 11:31 AM
Word takes 20 seconds to load and 15 seconds to unload. Why? =?Utf-8?B?Wi1SZXk=?= Microsoft Word Document Management 1 30th Apr 2005 12:25 AM
Word takes 20 seconds to start, Excel takes 1 second. Why? =?Utf-8?B?Wi1SZXk=?= Microsoft Word Document Management 1 9th Apr 2005 01:10 AM
Booting takes 42 seconds =?Utf-8?B?U3JpdmF0aHNhbg==?= Windows XP Embedded 2 21st Feb 2005 08:33 PM
Save takes seconds vs. SaveAs/Save As takes minutes Andrew H Microsoft Excel Programming 0 17th Aug 2004 07:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:20 AM.