Forex_Strategy_Builder.Indicator_Dialog.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 * 60);
            int btnVertSpace  = (int)(Data.VerticalDLU * 5.5);
            int btnHrzSpace   = (int)(Data.HorizontalDLU * 3);
            int space         = btnHrzSpace;
            int textHeight    = Font.Height;
            int controlHeight = Font.Height + 4;

            int rightColumnWight = 4 * buttonWidth + 3 * btnHrzSpace;
            int pnlTreeViewWidth = ClientSize.Width - rightColumnWight - 3 * space;

            // Panel pnlTreeViewBase
            pnlTreeViewBase.Size     = new Size(pnlTreeViewWidth, ClientSize.Height - 2 * space);
            pnlTreeViewBase.Location = new Point(space, space);

            int iRightColumnLeft = pnlTreeViewWidth + 2 * space;
            int iNumericUDWidth  = 65;

            // pnlParameterBase
            pnlParameters.Width    = rightColumnWight;
            pnlParameters.Location = new Point(iRightColumnLeft, space);

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

            //Button Default
            btnDefault.Size     = btnAccept.Size;
            btnDefault.Location = new Point(btnAccept.Right + btnHrzSpace, btnAccept.Top);

            //Button Help
            btnHelp.Size     = btnAccept.Size;
            btnHelp.Location = new Point(btnDefault.Right + btnHrzSpace, btnAccept.Top);

            //Button Cancel
            btnCancel.Size     = btnAccept.Size;
            btnCancel.Location = new Point(btnHelp.Right + btnHrzSpace, btnAccept.Top);

            // lblIndicatorInfo
            lblIndicatorInfo.Location = new Point(pnlParameters.Width - lblIndicatorInfo.Width - 1, 1);

            // lblIndicatorWarning
            lblIndicatorWarning.Location = new Point(lblIndicatorInfo.Left - lblIndicatorWarning.Width - 1, 1);

            // lblIndicator
            lblIndicator.Size     = new Size(pnlParameters.ClientSize.Width - 2 * border - 2 * space, 3 * lblIndicator.Font.Height / 2);
            lblIndicator.Location = new Point(border + space, (int)pnlParameters.CaptionHeight + space);

            // Logical Group
            Graphics g = CreateGraphics();
            lblGroup.Width = (int)g.MeasureString(Language.T("Group"), Font).Width + 10;
            g.Dispose();
            lblGroup.Height   = textHeight;
            lblGroup.Location = new Point(pnlParameters.ClientSize.Width - border - space - lblGroup.Width, lblIndicator.Bottom + space);

            // ComboBox Groups
            cbxGroup.Size     = new Size(lblGroup.Width, controlHeight);
            cbxGroup.Location = new Point(lblGroup.Left, aLblList[0].Bottom + space);

            int rightShift = Configs.UseLogicalGroups && (slotType == SlotTypes.OpenFilter || slotType == SlotTypes.CloseFilter) ? (lblGroup.Width + space) : 0;

            // Label Logic
            aLblList[0].Size     = new Size(pnlParameters.ClientSize.Width - 2 * border - 2 * space - rightShift, textHeight);
            aLblList[0].Location = new Point(border + space, lblIndicator.Bottom + space);

            // ComboBox Logic
            aCbxList[0].Size     = new Size(pnlParameters.ClientSize.Width - 2 * border - 2 * space - rightShift, controlHeight);
            aCbxList[0].Location = new Point(border + space, aLblList[0].Bottom + space);

            // ListParams
            for (int m = 0; m < 2; m++)
            for (int n = 0; n < 2; n++)
            {
                int i = 2 * m + n + 1;
                int x = (aCbxList[1].Width + space) * n + space + border;
                int y = (textHeight + controlHeight + 3 * space) * m + aCbxList[0].Bottom + 2 * space;

                aLblList[i].Size     = new Size((pnlParameters.ClientSize.Width - 3 * space - 2 * border) / 2, textHeight);
                aLblList[i].Location = new Point(x, y);

                aCbxList[i].Size     = new Size((pnlParameters.ClientSize.Width - 3 * space - 2 * border) / 2, controlHeight);
                aCbxList[i].Location = new Point(x, y + textHeight + space);
            }

            // NumParams
            for (int m = 0; m < 3; m++)
            for (int n = 0; n < 2; n++)
            {
                int i = 2 * m + n;
                int iLblWidth = (pnlParameters.ClientSize.Width - 5 * space - 2 * iNumericUDWidth - 2 * border) / 2;
                aLblNumeric[i].Size     = new Size(iLblWidth, controlHeight);
                aLblNumeric[i].Location = new Point((iLblWidth + iNumericUDWidth + 2 * space) * n + space + border, (controlHeight + 2 * space) * m + 2 * space + aCbxList[3].Bottom);

                aNudNumeric[i].Size     = new Size(iNumericUDWidth, controlHeight);
                aNudNumeric[i].Location = new Point(aLblNumeric[i].Right + space, aLblNumeric[i].Top);
            }

            // CheckParams
            for (int i = 0; i < 2; i++)
            {
                int iChbWidth = (pnlParameters.ClientSize.Width - 3 * space - 2 * border) / 2;
                aChbCheck[i].Size     = new Size(iChbWidth, controlHeight);
                aChbCheck[i].Location = new Point((space + iChbWidth) * i + space + border, aNudNumeric[4].Bottom + space);
            }

            pnlParameters.ClientSize = new Size(pnlParameters.ClientSize.Width, aChbCheck[0].Bottom + space + border);

            // Panel pnlSmallBalanceChart
            pnlSmallBalanceChart.Size     = new Size(rightColumnWight, btnAccept.Top - pnlParameters.Bottom - space - btnVertSpace);
            pnlSmallBalanceChart.Location = new Point(iRightColumnLeft, pnlParameters.Bottom + space);

            return;
        }