private void Go() { g = Graphics.FromImage(bitmap); g.Clear(Color.White); DrawCoordinateGrid(); Pen pencil = new Pen(System.Drawing.Color.Black); if (Mode == ProgrammMode.Segment) { g.DrawLine(pencil, startPoint.X * 20 + coordinateGridCenter.X, -startPoint.Y * 20 + coordinateGridCenter.Y, endPoint.X * 20 + coordinateGridCenter.X, -endPoint.Y * 20 + coordinateGridCenter.Y); foreach (var i in SegmentAlgoPoints) { g.FillEllipse(new SolidBrush(Color.Red), i.X * 20 + coordinateGridCenter.X, -i.Y * 20 + coordinateGridCenter.Y, 3, 3); } SegmentAlgoPoints.Clear(); } else if (Mode == ProgrammMode.Circle) { g.DrawEllipse(new Pen(Color.Black), coordinateGridCenter.X + Ox * 20 - R * 20, coordinateGridCenter.Y - Oy * 20 - R * 20, R * 40, R * 40); foreach (var i in CircleAlgoPoints) { g.FillEllipse(new SolidBrush(Color.Red), i.X * 20 + coordinateGridCenter.X, -i.Y * 20 + coordinateGridCenter.Y, 3, 3); } CircleAlgoPoints.Clear(); } pictureBox1.Image = bitmap; }
private void DrawCircle(float Ox, float Oy, int x, float y) { CircleAlgoPoints.Add(new Point(Ox + x, Oy + y)); CircleAlgoPoints.Add(new Point(Ox - x, Oy + y)); CircleAlgoPoints.Add(new Point(Ox + x, Oy - y)); CircleAlgoPoints.Add(new Point(Ox - x, Oy - y)); CircleAlgoPoints.Add(new Point(Ox + y, Oy + x)); CircleAlgoPoints.Add(new Point(Ox - y, Oy + x)); CircleAlgoPoints.Add(new Point(Ox + y, Oy - x)); CircleAlgoPoints.Add(new Point(Ox - y, Oy - x)); }