private void Canvas_MouseClick(object sender, MouseEventArgs e) { if (state.SelectedTool == ToolType.Resizer) { Shape s = getSelectedItem(e.X, e.Y); if (s != null) { state.SetCurrentShape(getShape(s.x1, s.y1, s.type)); state.RemoveShape(s); state.SetSelectedTool(ToolType.Liner); state.SetSelectedShape(ShapeType.Line); LineButton.Checked = true; foreach (var item in PaintToolsStrip.Items) { if (item.GetType().Equals(typeof(ToolStripButton))) { ((ToolStripButton)item).Checked = false; } } this.Invalidate(); } } else if (state.SelectedTool == ToolType.ColorPicker) { // TYPE COLOR PICKER LOGIC HERE Shape s = getSelectedItem(e.X, e.Y); if (s != null) { this.colorDialog1.ShowDialog(); //s.Color = this.colorDialog1.Color; this.Invalidate(); } } else if (state.CurrentShape == null) { state.SetCurrentShape(getShape(e.X, e.Y, state.SelectedShape)); } else { state.AddShape(state.CurrentShape); state.ClearCurrentShape(); this.Invalidate(); } }