Skip to main content

GraphicsCache.GetPen(Color, Int32) Method

Returns a pen with specified settings.

Namespace: DevExpress.Utils.Drawing

Assembly: DevExpress.Utils.v23.2.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public Pen GetPen(
    Color color,
    int width
)

Parameters

Name Type Description
color Color

A System.Drawing.Color object specifying the pen color.

width Int32

An integer value specifying the pen width.

Returns

Type Description
Pen

A System.Drawing.Pen object representing the requested pen.

Remarks

When the GetPen method is called, it checks whether the requested pen is already contained in an internal pens hash table. If so, the found pen is returned. Otherwise a new pen with specified parameters is created and added to an internal hash table. The hash table is initially empty. The introduced technique allows you to provide quick access to recently used pens.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetPen(Color, Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also