Windows form flicker with background image

  • Thread starter Thread starter AS
  • Start date Start date
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.
 
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.
 
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
 
Back
Top