ReDrawing of Bitmap is not smooth :(

  • Thread starter Thread starter Khadim
  • Start date Start date
K

Khadim

Friends,

The problem I am facing is that when my form resizes or is loaded
(invalidated), the background image of my form (which i have drawn
through GDI+ and also by putting a picture box on the form) is redrawn
several times which cause it to flicker a lot.
setstyles(controlstyles.doublebuffer, true ) didn't solved my problem.
I have 8 panels, 2 listviews and a few text boxes.

All panels are transparent so the portions of background image can be
shown.

Desperate need of assistance....
Thanks in advance...

Regards,
 
Double-buffering the form will not double-buffer the child controls too.

You will be able to reduce the problem by not calling the default
OnPaintBackground because that surely paints everything battleship grey
before you get to paint your own background.

Transparent controls are notoriously troublesome because they rely on
forcing the parent window to repaint itself in their graphics surfaces.

Try not to use PictureBox if you can help it. I can't be double buffered.
You can derive from it or even create your own from scratch and enable it's
own buffering.

--
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.
 
Bob,
thanks for ur reply....
Transparent controls are notoriously troublesome because they rely on
forcing the parent window to repaint itself in their graphics surfaces.
Try not to use PictureBox if you can help it. I can't be double buffered.
You can derive from it or even create your own from scratch and enable it's
own buffering.

I have also tried OnPaintBackground, by overridding it with an empty
body. But having almost same filkering. Also I have written in my post
that besides picture box I used GDI+ to paint my image as background
but the problem remains same as u wrote that transparent controls force
parent window to repaint itself in their graphics sirface.

Should I assume that this behaviour can't be tackled?

Regards with thanks,
 

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

Back
Top