Drawing circles with System.Drawing

c#, drawing

Solution

Try the DrawEllipse method instead.

Problem

I have this code that draws a Rectangle ( Im trying to remake the MS Paint ) ``` case "Rectangle": if (tempDraw != null) { tempDraw = (Bitmap)snapshot.Clone(); Graphics g = Graphics.FromImage(tempDraw); Pen myPen = new Pen(foreColor, lineWidth); g.DrawRectangle(myPen, x1, y1, x2-x1, y2-y1); myPen.Dispose(); e.Graphics.DrawImageUnscaled(tempDraw, 0, 0); g.Dispose(); } ``` But what if I want to draw a circle, what will change? ``` g.DrawRectangle(myPen, x1, y1, x2-x1, y2-y1); ```

Original source