public void RemoveColor(Color c) { if (ColorButtonMap.ContainsKey(c)) { var bt = ColorButtonMap[c]; Controls.Remove(bt); ColorButtonMap.Remove(c); if (ColorButtonMap.Count == 0) { SelectedColor = Color.Empty; } if (ColorRemoveEventHandler != null) { ColorRemoveEventHandler(this, new ColorEventAgs(c)); } } }
public void AddColor(Color c) { if (!ColorButtonMap.ContainsKey(c)) { var bt = new Button(); SetButtonInfo(bt, c); ColorButtonMap[c] = bt; this.Controls.Add(bt); if (ColorButtonMap.Count == 1) { SelectedColor = c; } if (ColorAddEventHandler != null) { ColorAddEventHandler(this, new ColorEventAgs(c)); } } }