private void AddPromoteButton(int id, Func <Image> getImage, Point location) { PromoteButton promote = new PromoteButton(id); promote.Image = getImage(); promote.Location = location; this.Controls.Add(promote); promote.Click += new EventHandler(promote_Click); }
protected void promote_Click(object sender, EventArgs e) { PromoteButton panel = (PromoteButton)sender; boardController.Promote(Id, panel.Id); }