|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Manually adding usercontrol to panel on formusercontrol 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 <tonny.st***@invenia.no> wrote in message
Show quoteHide quote news:1120031698.535131.31210@f14g2000cwb.googlegroups.com... Perhaps it might work better if you wrap it in SuspendLayout / ResumeLayout >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): calls
Other interesting topics
Inherited Menus and Modifiers
Obstruct the Developpers to Develop and Deploy a newer version All MDI forms repaint when one is resized Dialog ghost left on window RichTextBox auto scroll to end GridView Exception: reentrant call to the SetCurrentCellAddressCore function Editing hyperlinks in RichTextBox Control in C#.NET Screen.PrimaryScreen.WorkingArea question GDI+ Bitmap drawing vs GDI+ PrintDocument drawing MouseWheel |
|||||||||||||||||||||||