T
tonny.steen
I wonder if there is a way to have a flicker free initial paint of a
usercontrol on a panel (on a form) when done manually. My usercontrol
with many controls is first painted in its origional size, then resized
to fit the host panel (docked). This is not nice to look at since the
initial load/paint of the usercontrol is slow. So, my question is:
Is there a way to first have it resized then painted?
Code snipet from form (start):
private UserControl currentUserControl;
private void button1_Click(object sender, System.EventArgs e)
{
if (this.currentUserControl != null)
{
this.panel1.Controls.Remove(currentUserControl);
this.currentUserControl = null;
}
this.currentUserControl = new UserControl1();
this.currentUserControl.Name = "currentUserControl";
this.panel1.Controls.Add(currentUserControl);
this.panel1.Controls[0].Dock = DockStyle.Fill;
this.currentUserControl.Visible = true;
}
Code snipet (end):
- Tonny
usercontrol on a panel (on a form) when done manually. My usercontrol
with many controls is first painted in its origional size, then resized
to fit the host panel (docked). This is not nice to look at since the
initial load/paint of the usercontrol is slow. So, my question is:
Is there a way to first have it resized then painted?
Code snipet from form (start):
private UserControl currentUserControl;
private void button1_Click(object sender, System.EventArgs e)
{
if (this.currentUserControl != null)
{
this.panel1.Controls.Remove(currentUserControl);
this.currentUserControl = null;
}
this.currentUserControl = new UserControl1();
this.currentUserControl.Name = "currentUserControl";
this.panel1.Controls.Add(currentUserControl);
this.panel1.Controls[0].Dock = DockStyle.Fill;
this.currentUserControl.Visible = true;
}
Code snipet (end):
- Tonny