Resizing a form by its viewable area

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
 
R

Rob Teixeira [MVP]

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]
 
J

Jon Davis

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]
 

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