stopping "flickering effect"
-
Hy everyone! I do have a problem with my application: I do want to change the appearence of my application if the user wishes to. I do have a Windows.Forms and two User.Controls which are displayed. The user is able to select items from a combobox which might cause the displayed layout to change. When I do so then there is some kind of flickering. So I thought of freezing the layout until the changes are done. I did the following
this.SuspendLayout(); // do the changes, display new data etc. this.ResumeLayout(false);
well but the flickering is still there. The one control is a "single" control but the second one consists of one or more being placed on top of each other with the visibleoption displaying one at a time. Is the "overlaying" of the controls the reason? Because I thought as long as I do set the Windows.Forms to SuspendLayout everything in there is freezed until I do call ResumeLayout. But I am not sure if this includes the controls as well, which are added or deleted dynamically. Or do I have to suspend and then resume every element (meaning the controls) as well? Does anyone of you have an idea, what might be wrong in here? Thanks! Stephan. -
Hy everyone! I do have a problem with my application: I do want to change the appearence of my application if the user wishes to. I do have a Windows.Forms and two User.Controls which are displayed. The user is able to select items from a combobox which might cause the displayed layout to change. When I do so then there is some kind of flickering. So I thought of freezing the layout until the changes are done. I did the following
this.SuspendLayout(); // do the changes, display new data etc. this.ResumeLayout(false);
well but the flickering is still there. The one control is a "single" control but the second one consists of one or more being placed on top of each other with the visibleoption displaying one at a time. Is the "overlaying" of the controls the reason? Because I thought as long as I do set the Windows.Forms to SuspendLayout everything in there is freezed until I do call ResumeLayout. But I am not sure if this includes the controls as well, which are added or deleted dynamically. Or do I have to suspend and then resume every element (meaning the controls) as well? Does anyone of you have an idea, what might be wrong in here? Thanks! Stephan.Try placing the control in a panel. You can avoid flickering by hiding the panel and showing it when the new controls have been added:
panelContainer.Hide(); //do the changes, display new data etc. panelContainer.Show();
You can put a "Please Wait..." label underpanelContainer
, so that the user sees a message until the control are visible again.