3

In vb.net, what's the property of a Control to get the "inner size"? I mean the size that the control should have to doesn't display the scrollbars. I would like to resize a form following this criteria:

-If the inner size is too small, use the default form size.

-If the inner size is between a given range, resize the form to make the scrollbars disappear.

-If the inner size is too large, set a max size for the form and maintain the scrollbars.

I'm using a Devexpress LayoutControl. Thank you.

1 Answer 1

3

You can use the ClientSize property of the control (my emphasis).

The client area of a control is the bounds of the control, minus the nonclient elements such as scroll bars, borders, title bars, and menus. The SetClientSizeCore method is called to set the ClientSize property. The ClientSize property is not always changed through its set method so you should override the SetClientSizeCore method to ensure that your code is executed when the ClientSize property is set.

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.clientsize%28v=vs.80%29.aspx

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you for the reply. With ClientSize I get a size that is bigger than the effective needed size. So I get an empty space at the bottom of the control. I'm using a Devexpress LayoutControl.
Anyway, I suppose ClientSize is not what I need. From the description I understand that the ClientSize is the bounds of the control, so if the size in the form is 200x300 pixels and I have a vertical scrollbar, the size I get is something like 180x300. I don't need this. If the vertical scrollbar shows 150 additional pixels I want to get a size of 200x450 pixels... Clear as mud...
In the comment above I was talking about the PreferredSize! This property sometimes gives an height that's too big and sometimes it is too short!
But you are the only one that answered my question, so I'll accept your answer!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.