C# How to set control height in relative height
<p>My form contains a tab control. On one tab, I have three groupboxes. Each groupbox must have the height of one third of the height of the tab.</p>

<p>Right now I have this code on the layout event of the tab control:</p>

<pre><code>        // Determine the position of the group panels (gp)
        this.SuspendLayout();
        int oneThird = (tabPanel.Height - 5) / 3;

        if (_currentQuestion != null &amp;&amp; _currentQuestion.QuestionTypes == QuestionTypes.Infofield)
        {
            gpExplanation.Visible = false;
            gpFillInHelp.Visible = false;
            gpFillInQuestion.Height = oneThird * 3;
        }
        else
        {
            gpExplanation.Visible = true;
            gpFillInHelp.Visible = true;

            gpFillInQuestion.Height = oneThird;
            gpExplanation.Height = oneThird;
            gpFillInHelp.Height = oneThird;
        }

        // Determine position of the appointment and achievement group panels
        int height = tabPanel.Height - 30;
        int half = height / 2;

        pnlAppointment.Height = half;

        this.ResumeLayout();
</code></pre>

<p>I also have this code in the constructor of my form:</p>

<pre><code>// Set styles which prevent screen flickering
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
this.DoubleBuffered = true;
</code></pre>

<p>What is in your eyes the best way to set the height of the groupboxes? When the form resizes, the groupboxes height must be one third of the panels height.</p>

<p>I also want as less as possible flickering on the screen.</p>
