Voldemort Voldemort - 1 year ago 83
Vb.net Question

How can my form elements resize when the window is resized?

I have this form, with a tab control and a listbox inside:

enter image description here

When I resize the window's height, I get something like this:

enter image description here

However, I actually wanted the tab control and the listbox to resize along, having the following result:

enter image description here

I believe I could achieve this effect by just responding to some kind of

method in the form, and do my own calculations to manually update the size of the tab control and the listbox accordingly.

However, I've seen many applications achieve this effect, so I suspect there is actually a better way to do so - perhaps a builtin feature.

Do you know a better way to achieve this effect?

Answer Source

Here is a good tutorial that explains how to resize winform controls on resizing the container form control using the dock and anchor properties:


Setting the four values of the anchor property(top,right,bottom,left), you can make your control's edges to stay stationary with respect to the Form control even when it is re-sized.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download