Helpful Information
 
 
Category: .Net Development
A simple app written in C#/VS7 has very slow GUI

Hi all

My simple application written in C# using VS7 has very slow GUI, even on a fine tuned fast computer.

I believe that the code should perform much faster and therefore I'm writing this message describing my problem and asking for help.

The application I wrote has just one main Form class, containing some standard controls such as Tab control, RichText box, Toolbox and some Text labels, 40k source code in total.

Wehn running, the painting is terribly terribly slow. For instance, when resizing the window it takes good 2 - 3 seconds for the main window to repaint itself.

I have approx. 10 Text labels anchored on the bottom of the main window, and when I resize the window I can clearly see each of these text labels to be repainted one after another.... Switching between the tabs within the main form is equally slow. Each tab contains just one control docked on it, and it takes a second or two to have them repainted. I myself do not override any painting functions.

I compiled my code with the "release" configuration in VS7, no debugging info, code optimizing is on. I'm working on farily good Pentium III/700MHz with half gig of RAM. Any other application is working fast & perfectly fine, the computer is fine tuned.

To do some tests, I downloaded the SharpDevelop environment (very nice!) which itself was written in C#. With the same .NET Framework installed, the SharpDevelop has a sharp fast GUI....

I'm puzzled. I understand that the C# applications run "slower" than those written in C/C++, for obvious reasons. But the performance I see with my app goes beyond any level of tolerance. I hope there is some compiler option or somethnig...

Is there anything that could help? Any "setting" in VS options? :) Anything obvious? I'm sure I must have omitted something as I'm fairly new to this (wonderful) C#.

I use Windows 2000 Advanced Server SP2 with VS7 no SP.

Any hint is much appreciated! Good luck with your coding.

Ivo (yken)

Ok,

The mistery is now resolved. The cause of slow painting was a TransparencyKey property of the main Form class.

Setting this property to any color significatnly increases the time the window needs to paint itself. Leaving it unset brings the speed back.

Thanks everyone who considered any possible cause of the above problem and sorry for this monologue here :D

Good day everyone

Ivo (yken)










privacy (GDPR)