public Lasso(Point origin, int length, ref Cattle targetCattles) { this.origin = origin; this.length = length; this.targetCattle = targetCattles; buttons = new Button[length]; SuspendLayout(); for (int i = 0; i < length; ++i) { buttons[i] = new Button(); buttons[i].Location = new Point(origin.X - BTN_SHIFT * i, origin.Y - BTN_SHIFT * i); buttons[i].Name = "btn" + i; buttons[i].Size = new Size(BTN_SIZE, BTN_SIZE); buttons[i].TabIndex = i; buttons[i].UseVisualStyleBackColor = true; buttons[i].Click += new EventHandler(lasso_Click); if (isBlue(buttons[i].TabIndex)) { buttons[i].BackColor = Color.Blue; } buttons[i].BringToFront(); Controls.Add(buttons[i]); } ResumeLayout(false); }
private void InitCattle() { cattle = new Cattle(); }