Form on Panel not Anchoring/Resizing

  • Thread starter Thread starter Smidge Boyter
  • Start date Start date
S

Smidge Boyter

I have a MDI Child form with various controls and a panel. On the panel at
runtime I am adding a form to the panel. Everything works except when the
outer form is resized, the panel gets resized but the form on the panel
doesn't. It just stays in the same place that it starts out on. Below is
my code that is adding the form to the panel.

Any ideas?

mfrmProdSearch = new frmProductSearch();
mfrmProdSearch.TopLevel=false;
mfrmProdSearch.FormBorderStyle = FormBorderStyle.None;
mfrmProdSearch.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
mfrmProdSearch.Anchor = System.Windows.Forms.AnchorStyles.Top;
mfrmProdSearch.Anchor = System.Windows.Forms.AnchorStyles.Right;
mfrmProdSearch.Anchor = System.Windows.Forms.AnchorStyles.Left;
pnlMLProducts.Controls.Add(mfrmProdSearch);
mfrmProdSearch.Show();
 
Smidge Boyter said:
I have a MDI Child form with various controls and a panel. On the panel at
runtime I am adding a form to the panel. Everything works except when the
outer form is resized, the panel gets resized but the form on the panel
doesn't. It just stays in the same place that it starts out on. Below
is my code that is adding the form to the panel.

I strongly recommend to use user controls ("Project" -> "Add user
control...") instead of embedded forms.
 
Back
Top