Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a control resize itself when the window is maximized?

Tags:

c#

.net

winforms

I can't seem to figure this out. I have two group boxes on the left side of my form window. When the window is normal size (1000x700), the two boxes are the same. However, when the window is maximized, it ends up looking like this: http://imgur.com/X2Ou7.png

What I want is for both the "Log" group box and the tab control to extend down to the bottom of the window. I have tried messing with anchoring, but that just seems to move it and not resize it. Docking fills the whole side. What options do I have here?

like image 642
ryeguy Avatar asked Oct 21 '09 20:10

ryeguy


People also ask

What is the use of AutoSize Property in visual basic?

Use AutoSize to force a form to resize to fit its contents. A form does not automatically resize in the Visual Studio forms designer, regardless of the values of the AutoSize and AutoSizeMode properties. The form correctly resizes itself at run time according to the values of these two properties.

How do I resize a form in Visual Studio?

By dragging either the right edge, bottom edge, or the corner, you can resize the form. The second way you can resize the form while the designer is open, is through the properties pane. Select the form, then find the Properties pane in Visual Studio. Scroll down to size and expand it.


2 Answers

Make Log's

Anchor property= Top|Left|Bottom.

Make tab control's

Anchor property = Top|Left|Bottom|Right

like image 72
Jacob Seleznev Avatar answered Sep 22 '22 01:09

Jacob Seleznev


If you anchor to the top, it'll move the whole control up and down. If you anchor to top+bottom, it'll stretch the control so that it grows as the form grows.

like image 22
Jason Williams Avatar answered Sep 21 '22 01:09

Jason Williams