Working with Pens
Contents
[
Hide
]
Aspose.Drawing for .NET API provides the capability to draw graphics elements. Pens are one of the key elements of working with graphics and are used to draw different line objects such as an ellipse, circle, etc with the specified color.
Set Pen Width to Draw Graphics in C#
To draw graphics with a certain pen width, the following steps can be used.
- Create an object of the Bitmap class
- Initialize the Graphics object from the created bitmap
- Create a new Pen with the desired width
- Use the DrawLine method to draw a line with the desired width
- Save the output to any desired output image format
Set Pen Color to Draw Graphics in C#
To draw graphics with a certain pen color, the following steps can be used.
- Create an object of the Bitmap class
- Initialize the Graphics object from the bitmap
- Create a new Pen with the desired color
- Use the DrawLine method to draw a line
- Save the output to any desired output image format
Join lines to create Path in C#
Multiple lines can be joined to create a path. To join lines using C#, the following steps can be used.
- Create an object of the Bitmap class
- Initialize the Graphics object from the bitmap
- Create a GraphicsPath object to establish a path
- Use the LineJoin to join lines