Forex_Strategy_Builder.Strategy_Layout.ArrangeStrategyControls C# (CSharp) Method

ArrangeStrategyControls() public method

Calculates the position of the controls
public ArrangeStrategyControls ( ) : void
return void
        public void ArrangeStrategyControls()
        {
            int width  = ClientSize.Width;
            int height = ClientSize.Height;
            int totalHeight = PnlSlotCalculateTotalHeight(width);
            if (totalHeight < height)
            {
                VScrollBarStrategy.Enabled = false;
                VScrollBarStrategy.Visible = false;
            }
            else
            {
                width       = ClientSize.Width - VScrollBarStrategy.Width;
                totalHeight = PnlSlotCalculateTotalHeight(width);
                VScrollBarStrategy.Enabled     = true;
                VScrollBarStrategy.Visible     = true;
                VScrollBarStrategy.Value       = 0;
                VScrollBarStrategy.SmallChange = 100;
                VScrollBarStrategy.LargeChange = 200;
                VScrollBarStrategy.Maximum     = Math.Max(totalHeight - height + 220, 0);
                VScrollBarStrategy.Location    = new Point(width, 0);
                VScrollBarStrategy.Height      = height;
            }

            flowLayoutStrategy.Location = Point.Empty;
            flowLayoutStrategy.Width    = width;
            flowLayoutStrategy.Height   = totalHeight;

            // Strategy properties panel size
            int pnlPropertiesWidth  = flowLayoutStrategy.ClientSize.Width;
            int pnlPropertiesHeight = PnlPropertiesCalculateHeight(pnlPropertiesWidth);
            pnlProperties.Size = new Size(pnlPropertiesWidth, pnlPropertiesHeight);

            // Sets the strategy slots size
            for (int iSlot = 0; iSlot < slots; iSlot++)
            {
                int iStrWidth  = flowLayoutStrategy.ClientSize.Width;
                int iStrHeight = PnlSlotCalculateHeight(iSlot, iStrWidth);
                apnlSlot[iSlot].Size = new Size(iStrWidth, iStrHeight);
            }

            if (showAddSlotButtons)
            {
                int buttonWidth  = flowLayoutStrategy.ClientSize.Width - 60;
                int buttonHeight = (int)(Font.Height * 1.7);
                btnAddOpenFilter.Size     = new Size(buttonWidth, buttonHeight);

                btnClosingFilterHelp.Size = new Size(buttonHeight - 4, buttonHeight - 4);
                btnAddCloseFilter.Size    = new Size(buttonWidth, buttonHeight);
            }

            return;
        }