S
Shane
I have an application that creates "screens" on the fly via a panel on
a form that I add and remove controls from.
When the user wants to go to a new screen I call
panel.Controls.Clear() and this depending on the number of controls in
the array takes about 40 milliseconds per control! Adding new
controls to it taks about 5-20 ms per controls. When you have 20
controls (labels, and data collection fields) on each screen you are
waiting 1-2 seconds.
I see that suspend and resume layout have been removed from the CF,
but what other options do I have to prevent the UI from killing the
performance.
Code snipits:
public void NavigationPanel_Clear()
{
int x1 = Environment.TickCount;
this.navigationPanel.Controls.Clear();
int x2 = Environment.TickCount;
x2-=x1;
string msg = String.Format("Ending UIForm.NavigationPanel_Clear
took: {0} ms",x2.ToString() );
LogClass.AddLogEntry(SEVERITY.PERFORMANCE, msg);
}
public void NavigationPanel_View(Control ctrl)
{
int x1 = Environment.TickCount;
ctrl.Show();
this.navigationPanel.Controls.Add(ctrl);
int x2 = Environment.TickCount;
x2-=x1;
string msg = String.Format("Ending UIForm.NavigationPanel_View
took: {0} ms",x2.ToString() );
LogClass.AddLogEntry(SEVERITY.PERFORMANCE, msg);
}
I have already tried usind hide and show on the controls and this
worked great until we got more than 200 controls. At that point it
was taking 30 seconds to go from one screen to the next.
thanks,
Shane
a form that I add and remove controls from.
When the user wants to go to a new screen I call
panel.Controls.Clear() and this depending on the number of controls in
the array takes about 40 milliseconds per control! Adding new
controls to it taks about 5-20 ms per controls. When you have 20
controls (labels, and data collection fields) on each screen you are
waiting 1-2 seconds.
I see that suspend and resume layout have been removed from the CF,
but what other options do I have to prevent the UI from killing the
performance.
Code snipits:
public void NavigationPanel_Clear()
{
int x1 = Environment.TickCount;
this.navigationPanel.Controls.Clear();
int x2 = Environment.TickCount;
x2-=x1;
string msg = String.Format("Ending UIForm.NavigationPanel_Clear
took: {0} ms",x2.ToString() );
LogClass.AddLogEntry(SEVERITY.PERFORMANCE, msg);
}
public void NavigationPanel_View(Control ctrl)
{
int x1 = Environment.TickCount;
ctrl.Show();
this.navigationPanel.Controls.Add(ctrl);
int x2 = Environment.TickCount;
x2-=x1;
string msg = String.Format("Ending UIForm.NavigationPanel_View
took: {0} ms",x2.ToString() );
LogClass.AddLogEntry(SEVERITY.PERFORMANCE, msg);
}
I have already tried usind hide and show on the controls and this
worked great until we got more than 200 controls. At that point it
was taking 30 seconds to go from one screen to the next.
thanks,
Shane