void DrawFigure(int id) { gr = panel1.CreateGraphics(); switch (id) { case 1: MyRectangle rect = new MyRectangle(p1x, p1y, p2x, p2y); figs.Add(rect); rect.Draw(gr); break; case 2: int cx, cy; double r = Math.Sqrt(Math.Pow(p2x - p1x, 2) + Math.Pow(p2y - p1y, 2)); cx = p1x - (int)r; cy = p1y - (int)r; MyCircle circ = new MyCircle(cx, cy, r); figs.Add(circ); circ.Draw(gr); break; } }
public override void Draw(Graphics gr) { base.Draw(gr); wheell.Draw(gr); wheelr.Draw(gr); }