Forex_Strategy_Builder.Instrument_Editor.OnResize C# (CSharp) Метод

OnResize() защищенный Метод

Recalculates the sizes and positions of the controls after resizing.
protected OnResize ( EventArgs e ) : void
e System.EventArgs
Результат void
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

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

            // Button Close
            btnClose.Size     = new Size(buttonWidth, buttonHeight);
            btnClose.Location = new Point(ClientSize.Width - buttonWidth - 2 * space - 1, ClientSize.Height - buttonHeight - btnVertSpace);

            // pnlInstruments
            pnlInstruments.Size     = new Size(buttonWidth + 2 * space + 2, ClientSize.Height - 2 * space);
            pnlInstruments.Location = new Point(space, space);

            // pnlAddInstrument
            pnlAddInstrument.Size     = new Size(ClientSize.Width - 2 * space - pnlInstruments.Right, buttonHeight + 2 * space + (int)captionHeight + 2);
            pnlAddInstrument.Location = new Point(pnlInstruments.Right + space, btnClose.Top - btnVertSpace - pnlAddInstrument.Height);

            // pnlProperties
            pnlProperties.Size     = new Size(ClientSize.Width - 2 * space - pnlInstruments.Right, pnlAddInstrument.Top - 2 * space);
            pnlProperties.Location = new Point(pnlInstruments.Right + space, space);

            // Button Delete
            btnDelete.Size     = new Size(buttonWidth, buttonHeight);
            btnDelete.Location = new Point(btnHrzSpace, pnlInstruments.ClientSize.Height - buttonHeight - space);

            // Button Up
            btnUp.Size     = new Size((buttonWidth - space) / 2, buttonHeight);
            btnUp.Location = new Point(btnHrzSpace, btnDelete.Top - buttonHeight - space);

            // Button Down
            btnDown.Size     = new Size((buttonWidth - space) / 2, buttonHeight);
            btnDown.Location = new Point(btnUp.Right + btnHrzSpace, btnDelete.Top - buttonHeight - space);

            // lbxInstruments
            lbxInstruments.Size     = new Size(pnlInstruments.ClientSize.Width - 2 * btnHrzSpace - 2 * border, btnUp.Top - space - (int)captionHeight);
            lbxInstruments.Location = new Point(space + border, space + (int)captionHeight);

            // Properties' controls
            lblPropSymbol.Width      = buttonWidth;
            lblPropType.Width        = buttonWidth;
            lblPropComment.Width     = buttonWidth;
            lblPropDigits.Width      = buttonWidth;
            lblPropPoint.Width       = buttonWidth;
            lblPropLots.Width        = buttonWidth;
            lblPropSpread.Width      = buttonWidth;
            lblPropSwap.Width        = buttonWidth;
            lblPropCommission.Width  = buttonWidth;
            lblPropSlippage.Width    = buttonWidth;
            lblPropPriceIn.Width     = buttonWidth;
            lblPropAccountIn.Width   = buttonWidth;
            lblPropAccountRate.Width = 2 * buttonWidth + space;
            lblPropFileName.Width    = 2 * buttonWidth + space;
            lblPropDataFiles.Width   = 4 * buttonWidth + 3 * space;
            lblPropDataFiles.Height  = 2 * buttonWidth + 1 * space;
            lblPropSymbol.Location      = new Point(X(1), Y(1) + 1);
            lblPropType.Location        = new Point(X(3), Y(1) + 1);
            lblPropComment.Location     = new Point(X(1), Y(2) + 1);
            lblPropDigits.Location      = new Point(X(1), Y(3) + 1);
            lblPropPoint.Location       = new Point(X(3), Y(3) + 1);
            lblPropLots.Location        = new Point(X(1), Y(4) + 1);
            lblPropSpread.Location      = new Point(X(1), Y(5) + 1);
            lblPropSwap.Location        = new Point(X(1), Y(6) + 1);
            lblPropCommission.Location  = new Point(X(1), Y(7) + 1);
            lblPropSlippage.Location    = new Point(X(1), Y(8) + 1);
            lblPropPriceIn.Location     = new Point(X(1), Y(9) + 1);
            lblPropAccountIn.Location   = new Point(X(3), Y(9) + 1);
            lblPropAccountRate.Location = new Point(X(1), Y(10) + 1);
            lblPropFileName.Location    = new Point(X(1), Y(11) + 1);
            lblPropDataFiles.Location   = new Point(X(1), Y(12) + 1);

            tbxPropSymbol.Width      = buttonWidth;
            tbxPropType.Width        = buttonWidth;
            tbxPropComment.Width     = 3 * buttonWidth + 2 * space; ;
            tbxPropSpread.Width      = buttonWidth;
            tbxPropPriceIn.Width     = buttonWidth;
            tbxPropPoint.Width       = buttonWidth;
            tbxPropSlippage.Width    = buttonWidth;
            tbxPropAccountIn.Width   = buttonWidth;
            tbxPropAccountRate.Width = buttonWidth;
            tbxPropFileName.Width    = buttonWidth;
            tbxPropSymbol.Location      = new Point(X(2), Y(1) + 3);
            tbxPropType.Location        = new Point(X(4), Y(1) + 2);
            tbxPropComment.Location     = new Point(X(2), Y(2) + 3);
            tbxPropPoint.Location       = new Point(X(4), Y(3) + 3);
            tbxPropSpread.Location      = new Point(X(2), Y(5) + 2);
            tbxPropSlippage.Location    = new Point(X(2), Y(8) + 3);
            tbxPropPriceIn.Location     = new Point(X(2), Y(9) + 3);
            tbxPropAccountIn.Location   = new Point(X(4), Y(9) + 3);
            tbxPropAccountRate.Location = new Point(X(3), Y(10) + 3);
            tbxPropFileName.Location    = new Point(X(3), Y(11) + 3);

            cbxPropSwap.Width       = buttonWidth;
            cbxPropCommission.Width = buttonWidth;
            cbxPropCommScope.Width  = buttonWidth;
            cbxPropCommTime.Width   = buttonWidth;
            cbxPropSwap.Location       = new Point(X(2), Y(6) + 2);
            cbxPropCommission.Location = new Point(X(2), Y(7) + 2);
            cbxPropCommScope.Location  = new Point(X(3), Y(7) + 2);
            cbxPropCommTime.Location   = new Point(X(4), Y(7) + 2);

            nudPropDigits.Width      = buttonWidth;
            nudPropLotSize.Width     = buttonWidth;
            nudPropSpread.Width      = buttonWidth;
            nudPropSwapLong.Width    = buttonWidth;
            nudPropSwapShort.Width   = buttonWidth;
            nudPropCommission.Width  = buttonWidth;
            nudPropSlippage.Width    = buttonWidth;
            nudPropAccountRate.Width = buttonWidth;
            nudPropDigits.Location      = new Point(X(2), Y(3) + 4);
            nudPropLotSize.Location     = new Point(X(2), Y(4) + 4);
            nudPropSpread.Location      = new Point(X(3), Y(5) + 4);
            nudPropSwapLong.Location    = new Point(X(3), Y(6) + 4);
            nudPropSwapShort.Location   = new Point(X(4), Y(6) + 4);
            nudPropCommission.Location  = new Point(X(5), Y(7) + 4);
            nudPropSlippage.Location    = new Point(X(3), Y(8) + 4);
            nudPropAccountRate.Location = new Point(X(4), Y(10) + 4);

            // pnlAddInstrument's controls
            lblAddInstrSymbol.Width    = buttonWidth;
            lblAddInstrSymbol.Location = new Point(X(1), Y(1) + 1);
            tbxAddInstrSymbol.Width    = buttonWidth;
            tbxAddInstrSymbol.Location = new Point(X(2), Y(1) + 3);
            lblAddInstrType.Width      = buttonWidth;
            lblAddInstrType.Location   = new Point(X(3), Y(1) + 1);
            cbxAddInstrType.Width      = buttonWidth;
            cbxAddInstrType.Location   = new Point(X(4), Y(1) + 2);
            btnAddInstrAdd.Size        = new Size(buttonWidth, buttonHeight);
            btnAddInstrAdd.Location    = new Point(X(5), Y(1));

            // Button Accept
            btnAccept.Size     = new Size(buttonWidth, buttonHeight);
            btnAccept.Location = new Point(pnlProperties.ClientSize.Width - buttonWidth - space, pnlProperties.ClientSize.Height - buttonHeight - space);

            return;
        }