R
@Kelly said:Yes, flicker is a big problem. There are some things you can do to minimize flicker.
- Try creating sections invisible and then showing them,
- try reducing the use of docking and use Anchoring instead.
- Keep controls to a minimum as there is a big load on the UI as the number of .NET controls increases. I've had to eliminate nested panels and replace images and text with stuff drawn directly on the UI in Paint events.
Using a background thread doesn't help unless you have work to do and want sections to load data asynchronously. There is a huge amout of overhead in calling Invoke() over calling a method directly so your code could be slower if you used a background thread strictly to build UI.
Iirc, all the layout math is still done even if you create sections invisible. Also docking or anchoring doesn't, or atleast; shouldn't, really matter all that much as docking is just anchoring once at the extreme points. Eliminating a lot of controls and manually mucking around with the paint events might not be the most desirable approach either. It will absolutely kill maintainability.
The standard solution is to enable double buffering and make good use of calls to SuspendLayout() and ResumeLayout() to not perform needless layout resizing and repainting while adding/removing or moving/resizing sets of controls.
Indeed, I wouldn't recommend building UI in a background thread either. Not only because the overhead associated with Invoke might end up making it more expensive, but also because it is plain pointless. Why build a section of UI asynchronously, if you have to wait until said building is complete to do anything with it anyway? Generally speaking, it's not like you still need to do something with the old section of UI either: you accessed a new section to do something there instead.