private void Btn_MouseClick(object sender, MouseEventArgs e) { if (sender is Button) { Button btn = (Button)sender; if (e.Button == MouseButtons.Left) { if (btn.Tag is Color) { Color c = (Color)btn.Tag; foreach (Button b in buttons) { b.BackColor = Style.Default.MenuBackground; } btn.BackColor = Style.Default.Selection; SetColor?.Invoke(c); selectedColor = c; } } else if (e.Button == MouseButtons.Right) { lsel = buttons.IndexOf(btn); penCtx.Show(Cursor.Position); } } }
public void SetColorExtern(Color c) { selectedColor = c; refresh(true); SetColor?.Invoke(c); }