private void buttonstatchangecolor_Click(object sender, EventArgs e) { if (!painter.shape_was_select) { MessageBox.Show("No selected shape"); return; } IEditable shape = painter.selected_shape as IEditable; if (shape == null) { MessageBox.Show("This shape cant be edite"); return; } colorDialog.ShowDialog(); shape.ChangeColor(colorDialog.Color); painter.DrawShapeList(shape_list); painter.SelectShape(); Refresh(); }