- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Draw an ellipse in C#
To draw an ellipse, use the drawEllipse() method in C# that belong to the Graphics object. It has a pen object as well as a rectangle object.
You need windows form to draw shapes in C#.
Set graphics object.
Graphics g = this.CreateGraphics();
Now, the pen object.
Pen p = new Pen(new SolidBrush(Color.Red), 15);
The following is the rectangle object.
Rectangle r = new Rectangle(120, 60, 180, 180);
Now use the drawEllipse() method with the graphics object and add both the objects in it to draw an ellipse.
s.DrawEllipse(p, r);
Advertisements