views:

198

answers:

2

Hi all

i use some pictures in my 'MainForm' And My Windows Application was writing by c sharp. i use this form to start other forms in my project.

And I use some label and panel with Transparent Color. but when the program started i see many blink in transparent label and panel. And it is very bad.

How I Can Fix this problem?

A: 

did you test it on multiple machines.

did you use an updated machine with all the .net service packs needed.

etc

abmv
yes i test it in Multiple Machines ..
hosseinsinohe
+2  A: 

Enabling DoubleBuffered as stax suggested above is helpful but it may not be sufficient.

In your form, add the following method override:

protected override void OnPaintBackground(PaintEventArgs e) {}

And, in the OnPaint method, paint the background yourself instead. If you don't do this, drawing the background and painting are separate events, and background painting has higher priority, meaning that it will happen earlier.

Furthermore, if you add child controls (like labels), they receive their own paint background/paint events. You may be able to disable the Label's background. If I do stuff like this, I tend to not use controls but paint the text and the images in one OnPaint.

jdv
please write a sample about onPaintBackground And Onpaint
hosseinsinohe
I Can Not Work With onPaintBackground And OnpaintPlease help methank you
hosseinsinohe
Always prepared to help, but I think it is best if you post a sample C# application that demonstrates the problem. Just add the controls and set the properties as you do in your production code. And, tell us if you are running on Win7/Vista or XP.
jdv