Forex_Strategy_Builder.Strategy_Layout.InitializeStrategySlots C# (CSharp) Method

InitializeStrategySlots() public method

Initializes the strategy slots
public InitializeStrategySlots ( ) : void
return void
        public void InitializeStrategySlots()
        {
            apnlSlot       = new Panel[slots];
            abtnRemoveSlot = new Button[slots];

            // Strategy properties panel
            pnlProperties = new Panel();
            pnlProperties.Cursor  = Cursors.Hand;
            pnlProperties.Tag     = 100;
            pnlProperties.Margin  = new Padding(0, 0, 0, space);
            pnlProperties.Paint  += new PaintEventHandler(PnlProperties_Paint);
            pnlProperties.Resize += new EventHandler(PnlSlot_Resize);
            toolTip.SetToolTip(pnlProperties, slotPropertiesTipText);

            // Slot panels settings
            for (int iSlot = 0; iSlot < slots; iSlot++)
            {
                apnlSlot[iSlot] = new Panel();
                apnlSlot[iSlot].Cursor  = Cursors.Hand;
                apnlSlot[iSlot].Tag     = iSlot;
                apnlSlot[iSlot].Margin  = new Padding(0, 0, 0, space);
                apnlSlot[iSlot].Paint  += new PaintEventHandler(PnlSlot_Paint);
                apnlSlot[iSlot].Resize += new EventHandler(PnlSlot_Resize);
                toolTip.SetToolTip(apnlSlot[iSlot], slotToolTipText);

                if (showRemoveSlotButtons && iSlot != strategy.OpenSlot && iSlot != strategy.CloseSlot)
                {   // RemoveSlot buttons
                    abtnRemoveSlot[iSlot] = new Button();
                    abtnRemoveSlot[iSlot].Parent = apnlSlot[iSlot];
                    abtnRemoveSlot[iSlot].Tag    = iSlot;
                    abtnRemoveSlot[iSlot].Cursor = Cursors.Arrow;
                    abtnRemoveSlot[iSlot].BackgroundImage = Properties.Resources.close_button;
                    abtnRemoveSlot[iSlot].UseVisualStyleBackColor = true;
                    toolTip.SetToolTip(abtnRemoveSlot[iSlot], Language.T("Discard the logic condition."));
                }
            }

            // Ads the controls to the flow layout
            flowLayoutStrategy.Controls.Add(pnlProperties);
            for (int iSlot = 0; iSlot < slots; iSlot++)
            {
                if (showAddSlotButtons && iSlot == strategy.CloseSlot)
                    flowLayoutStrategy.Controls.Add(btnAddOpenFilter);
                flowLayoutStrategy.Controls.Add(apnlSlot[iSlot]);
            }
            if (showAddSlotButtons)
            {
                flowLayoutStrategy.Controls.Add(btnAddCloseFilter);
                flowLayoutStrategy.Controls.Add(btnClosingFilterHelp);
            }

            return;
        }