Description
The SetPen
method configures the pen used for drawing operations on a Bitmap
object. This method allows you to specify the color and width of the pen, which will be used for subsequent drawing operations such as lines, rectangles, and other shapes.
Usage
To use the SetPen
method, you need to provide a Color
object to define the pen's color and a float
value to specify the pen's width. Once set, these parameters will affect all drawing operations performed on the Bitmap
until the pen is changed again.
Example
// Example of using SetPen method
Bitmap bitmap = new Bitmap();
Color penColor = new Color(255, 0, 0); // Red color
float penWidth = 2.0f;
// Set the pen color and width
bitmap.SetPen(penColor, penWidth);
// Now you can draw with the specified pen settings
bitmap.DrawLine(new Vector2(10, 10), new Vector2(100, 100));