My application dynamically creates controls and adds them to a panel on a
form. This is done in the form load event.
>
I don't know if I would call it flickering, but parts of some controls get
displayed before others. They don't exactly flicker, they just appear in
pieces, instead of all at once. The controls include nested panels. I have
tried to avoid TableLayoutPane ls because the performance is so terrible.
>
Before I add the controls, I suspend layout for the form and the panel. The
form is double-buffered.
>
I also tried setting the panel.visible = false and then true when the
contols were all created and added to the panel, but it doesn't help.
>
It looks funky while the page is loading, although it loads fast so its not
too bad.
>
I would like to fix this, and I would appreciate any suggestions.
>
I don't know if I would call it flickering, but parts of some controls get
displayed before others. They don't exactly flicker, they just appear in
pieces, instead of all at once. The controls include nested panels. I have
tried to avoid TableLayoutPane ls because the performance is so terrible.
>
Before I add the controls, I suspend layout for the form and the panel. The
form is double-buffered.
>
I also tried setting the panel.visible = false and then true when the
contols were all created and added to the panel, but it doesn't help.
>
It looks funky while the page is loading, although it loads fast so its not
too bad.
>
I would like to fix this, and I would appreciate any suggestions.
load event, I add several panels, and on each panel I add about 20 controls.
I get a good draw by setting the form.visible to false at the beginning of
the form load event, and true at the bottom.
IMO, the flicker you are experiencing comes from more than one drawing
operation being performed in rapid succession. There is at least one draw
because of what you are doing in the load event, and later there is another
draw caused by .net/windows. The way to stop this is to run the load event
with the form's visible set to false.
Leave a comment: