Working with Vector Graphics in C#
Contents
[
Hide
]
Aspose.Drawing for .NET makes it easy for you to draw vector graphics using C#. The API lets you work with a variety of different vector graphics such as arcs, Bezier spline, Cardinal Spline, closed curves, ellipses, lines and a number of other types. This article contains C# examples for drawing different types of vector graphics using the API.
Draw Arc in C#
To drawn an arc using C#:
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Define a Pen object with desired parameters
- Use the DrawArc method of Graphics class object to draw an arc

Draw Bezier Spline in C#
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Define a Pen object with desired parameters
- Use the DrawBezier method of Graphics class object to draw Bezier Spline

Draw Cardinal Spline in C#
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Define a Pen object with desired parameters
- Use the DrawCurve method of Graphics class object to draw Cardinal Spline

Draw Closed Curve in C#
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Define a Pen object with desired parameters
- Use the DrawClosedCurve method of Graphics class object to draw closed curve

Draw Ellipse in C#
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Define a Pen object with desired parameters
- Use the DrawEllipse method of Graphics class object to draw Ellipse

Draw Lines in C#
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Define a Pen object with desired parameters
- Use the DrawLine method of Graphics class object to draw lines

Draw Path in C#
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Define a Pen object with desired parameters
- Initialize a new object of GraphicsPath class and add Lines to its path collection

Draw Polygon in C#
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Define a Pen object with desired parameters
- Use the DrawPolygon method of Graphics class object to draw Polygon

Draw Rectangle in C#
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Define a Pen object with desired parameters
- Use the DrawRectangle method of Graphics class object to draw Rectangle

Fill Region in C#
- Instantiate an object of Bitmap class
- Initialize an object of Graphics class from this bitmap
- Instantiate a GraphicsPath class object
- Add polygon to the Path collection of GraphicsPath class object
- Use the FillRegion method of Graphics class to fill defined regions
