Expanding user controls

  • Thread starter Thread starter OpticTygre
  • Start date Start date
O

OpticTygre

I have a treeview and a panel inside of a form. Depending on what item in
the treeview is clicked, different user controls get loaded into the panel.
If the form is resized, or maximized the panel stretches with the form, but
the user controls stay static. Is there a way I can stretch the user
control forms automatically (as well as reposition all objects on the user
controls) when the size of the panel changes? Thanks for any advice.

-Jason
 
I'm not sure if this is the best way to do it, but am I right in saying I
could just do something like:

Panel1.Controls.Item(0).Size = New Size(Panel1.Width, Panel1.Height)

in the main form, and handle the controls contained within the user controls
through each of the separate user control's resize event?

Is there a better way, or is that pretty much standard?

-Jason
 
I'm not sure if this is the best way to do it, but am I right in saying I
could just do something like:

Panel1.Controls.Item(0).Size = New Size(Panel1.Width, Panel1.Height)

Why not just anchor the UserControl to all sides of the Panel?
in the main form, and handle the controls contained within the user controls
through each of the separate user control's resize event?

This is definitely the way to go for controls in the UserControl itself.
 

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

Back
Top