performance in C# Application
i use some pictures in my 'MainForm'开发者_Go百科 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?
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
.
did you test it on multiple machines.
did you use an updated machine with all the .net service packs needed.
etc
精彩评论