Resizing a form by its viewable area

  • Thread starter Thread starter Jon Davis
  • Start date Start date
J

Jon Davis

If I have a UserControl of fixed size and I want to place it on a blank
form, then resize the form according to the size and shape of the
UserControl, how do I set that height/width on the form without it all
getting messed up by the form's title bar and border?

Or are height and width on Form objects not affected by the border and title
bar?

Jon
 
The Size property of the form is the overall size of the form rectangle,
including titlebar and frame area.
The ClientSize property is just the inner "workspace" area of the form.

So, in this case, just change the values of the ClientSize property to the
values the UserControl wants.

-Rob [MVP]
 
Exactly what I needed, thank you!

Jon


Rob Teixeira said:
The Size property of the form is the overall size of the form rectangle,
including titlebar and frame area.
The ClientSize property is just the inner "workspace" area of the form.

So, in this case, just change the values of the ClientSize property to the
values the UserControl wants.

-Rob [MVP]
 
Back
Top