/* ---- Relate to add button Action ---- */ public void add(string title, Color color, titleHnadler handler) { if (containsTheSameTitle(title)) { return; } Button btn = new Button(); btn.Text = title; initButtonPattern(btn); initButtonColors(btn, color); addButtonToPanel(btn); btn.Height = this.Height / bgPanel.Controls.Count; configureEvent(btn, title, handler); }
private void configureEvent(Button btn, string title, titleHnadler handler) { btn.MouseClick += Bt_MouseClick; buttonHandlers.Add(new AddButtonHandler(title, handler)); }