For the past few months I’ve been working almost exclusively in Visual Studio 2005 doing Windows Forms, in my past I haven’t done any serious windows form work since Visual Studio 6 with the majority in Visual Studio 3.0 (yikes! 16bit!) . Most of my time since then was spent doing web applications.
One thing I have learned is that by using traditional methods your visual studio application will be a slow beast.
I’ve found a few things that really speed up your application, and I’ll try to write an in depth post on each one.
1. Use BeginUpdate/EndUpdate and ResumeLayout/SuspendLayout whenever updating controls.
Example: Coming Soon.
2. DoubleBuffer your form.
Example: Coming Soon.
3. DoubleBuffer some controls, if they don’t allow it, create your own class.
Example: Coming Soon.
4. Use a background worker process.
Example: Coming Soon.
5. Do some work in the Application Idle event
Example: Coming Soon.
6. When working with slow controls like the TableLayOutPanel, try using anchor instead of dock
Example: Coming Soon.
7. When working with datacolumn object be sure to dispose of it when finished.
Example: Coming Soon.
8. When working with graphics, dispose of Pen objects when no longer needed.
Example: Coming Soon.
9. If you use databinding on your controls make sure you do it first.
Example: Coming Soon.
10. Use performlayout()
Example: Coming Soon.
11. Use Microsoft’s performance tool to identify problem functions.
Example: Coming Soon.
By just employing some of these tactics your users should at very least get a better user experience and perhaps you will get some boasts in performance.