Mega Code Archive

 
Categories / C# Tutorial / 2D Graphics
 

Draw an ellipse

using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; public class DrawAnEllipse : System.Windows.Forms.Form {   public DrawAnEllipse()   {     this.BackColor = System.Drawing.Color.White;     this.ClientSize = new System.Drawing.Size(400, 400);     this.Paint += new System.Windows.Forms.PaintEventHandler(this.DrawAnEllipse_Paint);   }   static void Main()    {     Application.Run(new DrawAnEllipse());   }   private void DrawAnEllipse_Paint(object sender, System.Windows.Forms.PaintEventArgs e)   {     Graphics g = e.Graphics;     //      Pen p2 = new Pen(Color.Gray, 7);     g.DrawEllipse(p2, 200, 200, 150, 190);   } }