user interface – C# Ensuring the GUI is as smooth as possible – Education Career Blog

I’m being overly simplistic here, but say I have a WinForm with several controls on it (for example: a textbox, a treeview and a listview).

To ensure the smoothest possible experience for the future (for instance, that listview may one day hold a lot of data), what should be done at the start?

My knowledge of this kind of thing is very limited, but I’m assuming double buffering is advised? I’ve also heard something about overriding the OnPaint method for some controls?

Thanks
Zach

,

When designing new applications you don’t have to think about this stuff. In case you run into problems later, a fix can be applied without destroying the work you have already put into the project. Although I can assure you that 95% of the applications don’t need any special optimizations regarding controls or painting of controls, especially not in OnPaint. Good luck.

,

To ensure the smoothest possible experience for the future (for instance, that listview may one day hold a lot of data), what should be done at the start?

1- If it is going to store a huge data , try to implement pagination for the data.

2- You are using treeview , don’t try to load whole tree in memory. Use On demand Loading of tree i.e. only show the root nodes and when user click to expand a node only then load data.

3- If your application provides a functionality of searching nodes in tree than try to remember that tree is a special kind of graph so use proper graph algorithms like (DFS , BFS) to search the node.

4- Try to move operations which consumes lot of time in the background worker component , it supoorts event based notification which helps you to report progress of your operations.

5- Try to use caching of non frequetly changed data , that menas if suppose , you are having a winforms which shows a dripdown list of countries so just pick the data once and store it in memory so that , you won’t need a new database call every time when you need that data.

this is very initial steps but there can be lot of other also like using WeakRefernce class for your tree view.

Try to read performance optimization at MSDN.

Leave a Comment