Skip to main content

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

Returns a linear gradient brush with the specified settings.

Namespace: DevExpress.Utils.Drawing

Assembly: DevExpress.Utils.v23.2.dll

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

Declaration

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

Parameters

Name Type Description
rect Rectangle

A 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 Color object that represents the starting color for the gradient.

endColor Color

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

mode LinearGradientMode

A LinearGradientMode enumeration value specifying the gradient’s orientation.

blendCount Int32

An integer value specifying the number of blend patterns for the brush.

Returns

Type Description
Brush

A 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 brush found is returned. Otherwise a new brush with the specified parameters is created and added to an internal hash table, initially the hash table is empty. This gives you the ability to quickly access recently used linear gradient brushes.

See Also