I've the question while doing panel refresh. I found that the more controls created, the slower the panel refresh. So, if there any way to stop refresh the panel immediately, and do refresh in once at last?
Here's the codes how I refresh my panel. I'm a newbie with less knowledge in C#, and really hope for help.
private void DoPanelReresh()
{
int height = pl_Main.VerticalScroll.Value;
pl_Main.Controls.Clear();
if (PCandPLC.Equals(EPcPlc.PLC_to_PC))
{
if (stations_PLC.Count - 1 >= 0)
{
for (int x = stations_PLC.Count - 1; x >= 0; x--)
{
pl_Main.Controls.Add(stations_PLC[x]);
}
}
}
else
{
if (stations_PC.Count - 1 >= 0)
{
for (int x = stations_PC.Count - 1; x >= 0; x--)
{
pl_Main.Controls.Add(stations_PC[x]);
}
}
}
pl_Main.VerticalScroll.Value = height;
}