Windows form flicker with background image

A

AS

Hi,

I have a windows form with a background image - set through the forms
background image property. The form also has panels and icons on top of

it.


When this form is loading, there's a lot of flicker in the screen.


I tried reducing this by enabling double buffering -


//Constructor
this.SetStyle(ControlStyles.DoubleBuffer,true);
this.SetStyle(ControlStyles.UserPaint ,true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint,true);


Even after this there's no change. How do I solve this?
The background image is a .png image and its size is 60k.
 
C

Chris S.

Have you tried overriding the OnPaintBackground method, and leaving it
blank so that the base isn't called? From experience I've found that
this helps with almost all flicker problems. It has its side effects
though.

Also the double buffer that is built in doesn't always work as well as
having your own buffer that you write to. Again, just my own experience.
 
B

beaker

AS said:
Hi,

I have a windows form with a background image - set through the forms
background image property. The form also has panels and icons on top of

it.


When this form is loading, there's a lot of flicker in the screen.


I tried reducing this by enabling double buffering -


//Constructor
this.SetStyle(ControlStyles.DoubleBuffer,true);
this.SetStyle(ControlStyles.UserPaint ,true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint,true);


Even after this there's no change. How do I solve this?
The background image is a .png image and its size is 60k.


I found I was getting some flicker recently with a background image -
the form flashed black when first loaded.

Turns out I had set a Transparency Key value (had been playing around
with values for it out of curiosity) and removing that sorted out my
problem.

Gary
 

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