Forex_Strategy_Builder.Optimizer.OnResize C# (CSharp) Method

OnResize() protected method

Recalculates the sizes and positions of the controls after resizing.
protected OnResize ( EventArgs e ) : void
e System.EventArgs
return void
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            int buttonHeight = (int)(Data.VerticalDLU * 15.5);
            int buttonWidth  = (int)(Data.HorizontalDLU * 60);
            int btnVertSpace = (int)(Data.VerticalDLU * 5.5);
            int btnHrzSpace  = (int)(Data.HorizontalDLU * 3);
            int space        = btnHrzSpace;
            int textHeight   = Font.Height;

            // Button Cancel
            btnCancel.Size     = new Size(buttonWidth, buttonHeight);
            btnCancel.Location = new Point(ClientSize.Width - buttonWidth - btnHrzSpace, ClientSize.Height - buttonHeight - btnVertSpace);

            // Button Accept
            btnAccept.Size     = new Size(buttonWidth, buttonHeight);
            btnAccept.Location = new Point(btnCancel.Left - buttonWidth - btnHrzSpace, ClientSize.Height - buttonHeight - btnVertSpace);

            // Button Optimize
            btnOptimize.Size     = new Size(buttonWidth, buttonHeight);
            btnOptimize.Location = new Point(btnAccept.Left - buttonWidth - btnHrzSpace, ClientSize.Height - buttonHeight - btnVertSpace);

            // ProgressBar
            progressBar.Size     = new Size(ClientSize.Width - 2 * space, (int)(Data.VerticalDLU * 9));
            progressBar.Location = new Point(space, btnCancel.Top - progressBar.Height - btnVertSpace);

            // Panel Preview
            smallBalanceChart.Size     = new Size(ClientSize.Width - 2 * space, 200);
            smallBalanceChart.Location = new Point(space, progressBar.Top - space - smallBalanceChart.Height);

            // Panel Params Base
            pnlParamsBase.Size     = new Size(ClientSize.Width - 2 * space, smallBalanceChart.Top - 2 * space);
            pnlParamsBase.Location = new Point(space, space);

            // Panel Params Base 2
            pnlParamsBase2.Size = new Size(pnlParamsBase.Width - 2 * border, pnlParamsBase.Height - pnlCaptions.Height - border);
            pnlParamsBase2.Location = new Point(border, pnlCaptions.Height);

            // Panel Params
            pnlParams.Width = pnlParamsBase2.ClientSize.Width - scrollBar.Width;

            // Panel Limitations
            pnlLimitations.Size     = pnlParamsBase.Size;
            pnlLimitations.Location = pnlParamsBase.Location;

            btnShowLimitations.Size     = new Size(20, 16);
            btnShowLimitations.Location = new Point(pnlCaptions.ClientSize.Width - btnShowLimitations.Width - 1, 1);
            btnShowSettings.Size        = new Size(20, 16);
            btnShowSettings.Location    = new Point(pnlLimitations.ClientSize.Width - btnShowSettings.Width - 1, 1);

            // chbOutOfSample
            chbOutOfSample.Location = new Point(space, btnCancel.Top + 5);

            // nudOutOfSample
            nudOutOfSample.Width    = 65;
            nudOutOfSample.Location = new Point(chbOutOfSample.Right + space, btnCancel.Top + 3);

            int nudWidth = 55;

            // chbAmbiguousBars
            chbAmbiguousBars.Location = new Point(border + 5, 27);

            // nudAmbiguousBars
            nudAmbiguousBars.Width    = nudWidth;
            nudAmbiguousBars.Location = new Point(pnlLimitations.ClientSize.Width - nudWidth - border - 5, chbAmbiguousBars.Top - 1);

            // MaxDrawdown
            chbMaxDrawdown.Location = new Point(border + 5, chbAmbiguousBars.Bottom + border + 4);
            nudMaxDrawdown.Width    = nudWidth;
            nudMaxDrawdown.Location = new Point(nudAmbiguousBars.Left , chbMaxDrawdown.Top - 1);

            // MaxDrawdown %
            chbEquityPercent.Location = new Point(border + 5, nudMaxDrawdown.Bottom + border + 4);
            nudEquityPercent.Width    = nudWidth;
            nudEquityPercent.Location = new Point(nudAmbiguousBars.Left, chbEquityPercent.Top - 1);

            // MinTrades
            chbMinTrades.Location = new Point(border + 5, chbEquityPercent.Bottom + border + 4);
            nudMinTrades.Width    = nudWidth;
            nudMinTrades.Location = new Point(nudAmbiguousBars.Left, chbMinTrades.Top - 1);

            // MaxTrades
            chbMaxTrades.Location = new Point(border + 5, chbMinTrades.Bottom + border + 4);
            nudMaxTrades.Width    = nudWidth;
            nudMaxTrades.Location = new Point(nudAmbiguousBars.Left, chbMaxTrades.Top - 1);

            // WinLossRatios
            chbWinLossRatio.Location = new Point(border + 5, chbMaxTrades.Bottom + border + 4);
            nudWinLossRatio.Width    = nudWidth;
            nudWinLossRatio.Location = new Point(nudAmbiguousBars.Left, chbWinLossRatio.Top - 1);

            // pnlCaptions
            pnlCaptions.Height = 20;

            pnlCaptions.Invalidate();

            return;
        }