YATA.Sett.AddButtons C# (CSharp) Méthode

AddButtons() private méthode

private AddButtons ( int amount, int yPos, Color cols, bool enab, int yPosNAME, int RemoveFromX ) : System.Windows.Forms.Button[]
amount int
yPos int
cols Color
enab bool
yPosNAME int
RemoveFromX int
Résultat System.Windows.Forms.Button[]
        private Button[] AddButtons(int amount, int yPos, Color[] cols, bool enab ,int yPosNAME, int RemoveFromX = 0)
        {
            Button[] btnArray = new Button[amount + 1];
            for (int i = 0; i < amount; i++) {
                btnArray[i] = new Button();
                btnArray[i].FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                btnArray[i].Size = new System.Drawing.Size(20, 20);
                btnArray[i].Location = new System.Drawing.Point(110 + (i * 22) - RemoveFromX, 20 + (25 * yPos));
                btnArray[i].Name = yPosNAME + "-" + i;
                btnArray[i].Click += new System.EventHandler(colorSelect);
                btnArray[i].Enabled = enab;
                btnArray[i].ForeColor = enab == true ? Color.Black : Color.Gray;
                if (enab) btnArray[i].BackColor = cols[i];
                if (yPosNAME < 15) toolTip1.SetToolTip(btnArray[i], messages[yPosNAME]);
            }
            return btnArray;
        }