private void MainForm_Paint(object sender, PaintEventArgs e) { g = e.Graphics; DrawnShapesList.DrawAll(g); if (_mousePressed && _drawnShapeIsOriginal) { (SelectedMaker.Make(LineColorPBox.BackColor, (int)LineThicknessUpDown.Value, penStyle, StartPoint.X, StartPoint.Y, FinishPoint.X, FinishPoint.Y)).draw(g); } else if (_mousePressed) { ((Shape)Activator.CreateInstance((Type)PluginsComboBox.SelectedItem, LineColorPBox.BackColor, (int)LineThicknessUpDown.Value, penStyle, StartPoint.X, StartPoint.Y, FinishPoint.X, FinishPoint.Y)).draw(g); } }
private void MainForm_MouseUp(object sender, MouseEventArgs e) { FinishPoint = new Point(e.X, e.Y); _mousePressed = false; if (StartPoint != FinishPoint) { if (_drawnShapeIsOriginal) { DrawnShape = SelectedMaker.Make(LineColorPBox.BackColor, (int)LineThicknessUpDown.Value, penStyle, StartPoint.X, StartPoint.Y, FinishPoint.X, FinishPoint.Y); } else { DrawnShape = (Shape)Activator.CreateInstance((Type)PluginsComboBox.SelectedItem, LineColorPBox.BackColor, (int)LineThicknessUpDown.Value, penStyle, StartPoint.X, StartPoint.Y, FinishPoint.X, FinishPoint.Y); } DrawnShapesList.Add(DrawnShape); ShapeListBox.Items.Add(DrawnShape.EngName); Invalidate(); } }