backgroundimage problem with flickering

J

jediknight

Hi All,

I am trying to use the example in codeproject
(http://www.codeproject.com/cs/media/flickerFreeDrawing.asp) called
Flicker free drawing using GDI+ and C# which all well and good but I am
trying to also draw a background image.

I have a form on which I have placed a panel. I am drawing on this
panel little boxes as in the example but I also need to show a
background image for the panel.
If I put an image in the design view then it draws the image at the
start then I get a white background. I have tried putting the
backgroundimage of the panel in at different places for example in
OnPaint but it flickers quite badly.

Can anyone tell me what I can do please???

Thanks in advance..
 
M

Michael Powell

Hi
try overriding OnPaintBackground and custom painting it there
also try leaving it in the OnPaint event, just double buffer your form as
follows:

public form1()
{
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top