Draw an ellipse : Ellipse « 2D « C# / CSharp Tutorial






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);
  }
}








27.8.Ellipse
27.8.1.Draw an ellipseDraw an ellipse
27.8.2.DrawEllipse: Traffic Lights