
Drawing shapes is a core part of graphics programming. This guide shows how to draw a circle and a filled circle in C# with the .NET framework. Whether you are building a game, a graphics app, or improving your C# skills, this tutorial helps you start drawing circles in C#.
Make Circle Drawing in C# - API Configuration
To work with graphics like circles and their variations, install the Conholdate.Total for .NET API. Download the DLL file or run the NuGet command:
PM> NuGet\Install-Package Conholdate.Total
Draw a Circle in C#
To draw a circle on an image, follow these steps:
- Create a Bitmap object.
- Create a Graphics object from the bitmap.
- Initialize a Pen object.
- Draw the circle and save the image.
The code snippet below demonstrates how to draw a circle in C#:
Draw a Filled Circle on an Image in C#
You can also draw a filled circle using overloaded methods. Follow these steps:
- Create a new Bitmap.
- Get a Graphics instance from the bitmap.
- Use FillEllipse to draw the filled circle.
- Save the resulting image.
The sample code shows how to draw a filled circle in C#:
Free Evaluation License
You may get a free temporary license to evaluate various features of the API without any limitations.
Wrapping Up
This guide explained how to draw both an outlined circle and a filled circle in C#. You can experiment with different colors, sizes, and positions to enhance your graphics. For questions or support, visit the forum.
FAQs
What is the difference between DrawEllipse and FillEllipse?
DrawEllipse draws only the outline, while FillEllipse fills the interior with a color.
How do I resize the circle?
Adjust the width and height parameters in the DrawEllipse or FillEllipse methods.
Can I draw multiple circles?
Yes, call the drawing method multiple times with different parameters.