0

I am having trouble re-sizing some of my controls when I give a window the ability to be maximized. The two controls lies next to each in the window as displayed in the picture. I have experimented with various ways of anchoring, docking, and auto growing them, but it always seems to move or grow them in some odd way. enter image description here

What I want is when the window is maximized, the 2 controls should each grow and fill half the width of the window, leaving the other half to the other control as in the picture below. enter image description here Am I missing something in Visual Studio designer mode, or should this be done some way in code?

Code Vader
  • 739
  • 3
  • 9
  • 26

1 Answers1

0

You can do this with your form's Resize event:

EDIT: Anchor your groupboxes' top & bottom only.

    private void Form1_Resize(object sender, EventArgs e)
    {
        groupBox1.Left = 5;
        groupBox2.Left = groupBox1.Left + groupBox1.Width + 5;
        groupBox1.Width = groupBox2.Width = this.Width / 2;  
    }
mimozz
  • 94
  • 1
  • 9