Form on Panel not Anchoring/Resizing

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();
 
H

Herfried K. Wagner [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top