Table of Contents

Method GetPen

Namespace
Alternet.Drawing
Assembly
Alternet.UI.Common.dll

GetPen(int)

Retrieves a Pen instance with the specified width.

public virtual Pen GetPen(int width)

Parameters

width int

The width of the pen to retrieve. Must be a positive integer.

Returns

Pen

A Pen instance with the specified width. If the width is less than or equal to a predefined maximum cached width, a cached instance may be returned; otherwise, a new instance is created.

Remarks

This method optimizes performance by caching Pen instances for widths up to a predefined limit. For widths exceeding the cache limit, a new Pen instance is created on each call.