Skip to main content
A newer version of this page is available. .

GraphicsCache.GetGradientBrush(Rectangle, Color, Color, LinearGradientMode) Method

Returns a linear gradient brush with specified settings.

Namespace: DevExpress.Utils.Drawing

Assembly: DevExpress.Utils.v18.2.dll

Declaration

public Brush GetGradientBrush(
    Rectangle rect,
    Color startColor,
    Color endColor,
    LinearGradientMode mode
)

Parameters

Name Type Description
rect Rectangle

A System.Drawing.Rectangle structure that specifies the endpoints of the linear gradient. The starting point is the upper-left corner of the rectangle, and the endpoint is the upper-right corner of the rectangle.

startColor Color

A System.Drawing.Color object that represents the starting color for the gradient.

endColor Color

A System.Drawing.Color object that represents the ending color for the gradient.

mode LinearGradientMode

A System.Drawing.Drawing2D.LinearGradientMode enumeration value specifying the gradient orientation.

Returns

Type Description
Brush

A System.Drawing.Brush descendant representing the requested linear gradient brush (typically a System.Drawing.Drawing2D.LinearGradientBrush object).

Remarks

When the GetGradientBrush method is called, it checks whether the requested brush is already contained in an internal hash table of linear gradient brushes. If so, the found brush is returned. Otherwise a new brush 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 linear gradient brushes.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetGradientBrush(Rectangle, Color, Color, LinearGradientMode) 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