Hossein Moradinia
Hossein Moradinia

Reputation: 6244

performance in C# Application

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?

Upvotes: 0

Views: 630

Answers (2)

user180326
user180326

Reputation:

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.

Upvotes: 2

abmv
abmv

Reputation: 7098

did you test it on multiple machines.

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

etc

Upvotes: 0

Related Questions