Skip to main content

LinearGradientBrush

Namespace: System.Drawing.Drawing2D

Assembly: System.Drawing.Managed (4.0.0.0)

Encapsulates a Brush with a linear gradient. This class cannot be inherited.

public class LinearGradientBrush : Brush

Constructors

Instance member LinearGradientBrush(point1, point2, color1, color2)

Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

NameTypeDescription
point1PointFA PointF structure that represents the starting point of the linear gradient.
point2PointFA PointF structure that represents the endpoint of the linear gradient.
color1ColorA Color structure that represents the starting color of the linear gradient.
color2ColorA Color structure that represents the ending color of the linear gradient.

Instance member LinearGradientBrush(point1, point2, color1, color2)

Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

NameTypeDescription
point1PointA Point structure that represents the starting point of the linear gradient.
point2PointA Point structure that represents the endpoint of the linear gradient.
color1ColorA Color structure that represents the starting color of the linear gradient.
color2ColorA Color structure that represents the ending color of the linear gradient.

Instance member LinearGradientBrush(rect, color1, color2, linearGradientMode)

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation mode.

NameTypeDescription
rectRectangleFA RectangleF structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
linearGradientModeLinearGradientModeA LinearGradientMode enumeration element that specifies the orientation of the gradient. The orientation determines the starting and ending points of the gradient. For example, specifies that the starting point is the upper-left corner of the rectangle and the ending point is the lower-right corner of the rectangle.

Instance member LinearGradientBrush(rect, color1, color2, linearGradientMode)

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and orientation.

NameTypeDescription
rectRectangleA Rectangle structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
linearGradientModeLinearGradientModeA LinearGradientMode enumeration element that specifies the orientation of the gradient. The orientation determines the starting and ending points of the gradient. For example, specifies that the starting point is the upper-left corner of the rectangle and the ending point is the lower-right corner of the rectangle.

Instance member LinearGradientBrush(rect, color1, color2, angle)

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

NameTypeDescription
rectRectangleFA RectangleF structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
angleSingleThe angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

Instance member LinearGradientBrush(rect, color1, color2, angle)

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

NameTypeDescription
rectRectangleA Rectangle structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
angleSingleThe angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

Instance member LinearGradientBrush(rect, color1, color2, angle, isAngleScalable)

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

NameTypeDescription
rectRectangleFA RectangleF structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
angleSingleThe angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.
isAngleScalableBooleanSet to to specify that the angle is affected by the transform associated with this LinearGradientBrush; otherwise, .

Instance member LinearGradientBrush(rect, color1, color2, angle, isAngleScalable)

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

NameTypeDescription
rectRectangleA Rectangle structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
angleSingleThe angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.
isAngleScalableBooleanSet to to specify that the angle is affected by the transform associated with this LinearGradientBrush; otherwise, .

Properties

Instance member Blend

Blend: Gets or sets a Blend that specifies positions and factors that define a custom falloff for the gradient.

Instance member GammaCorrection

Boolean: Gets or sets a value indicating whether gamma correction is enabled for this LinearGradientBrush.

Instance member InterpolationColors

ColorBlend: Gets or sets a ColorBlend that defines a multicolor linear gradient.

Instance member LinearColors

Color[]: Gets or sets the starting and ending colors of the gradient.

Instance member Rectangle

RectangleF: Gets a rectangular region that defines the starting and ending points of the gradient.

Instance member Transform

Matrix: Gets or sets a copy Matrix that defines a local geometric transform for this LinearGradientBrush.

Instance member WrapMode

WrapMode: Gets or sets a WrapMode enumeration that indicates the wrap mode for this LinearGradientBrush.

Methods

Instance member Clone()

Creates an exact copy of this LinearGradientBrush.

Returns: Object. The LinearGradientBrush this method creates, cast as an object.

Instance member MultiplyTransform(matrix)

Multiplies the Matrix object that represents the local geometric transformation of this LinearGradientBrush object by the specified Matrix object by prepending the specified Matrix object.

ParameterTypeDescription
matrixMatrixThe Matrix object by which to multiply the geometric transformation.

Instance member MultiplyTransform(matrix, order)

Multiplies the Matrix object that represents the local geometric transformation of this LinearGradientBrush object by the specified Matrix object in the specified order.

ParameterTypeDescription
matrixMatrixThe Matrix object by which to multiply the geometric transformation.
orderMatrixOrderA MatrixOrder enumeration that specifies the order in which to multiply the two matrices.

Instance member ResetTransform()

Resets the property of this LinearGradientBrush object to identity.

Instance member RotateTransform(angle)

Rotates the local geometric transformation of this LinearGradientBrush object by the specified amount. This method prepends the rotation to the transformation.

ParameterTypeDescription
angleSingleThe angle of rotation.

Instance member RotateTransform(angle, order)

Rotates the local geometric transformation of this LinearGradientBrush object by the specified amount in the specified order.

ParameterTypeDescription
angleSingleThe angle of rotation.
orderMatrixOrderA MatrixOrder enumeration that specifies whether to append or prepend the rotation matrix.

Instance member ScaleTransform(sx, sy)

Scales the local geometric transformation of this LinearGradientBrush object by the specified amounts. This method prepends the scaling matrix to the transformation.

ParameterTypeDescription
sxSingleThe amount by which to scale the transformation in the x direction.
sySingleThe amount by which to scale the transformation in the y direction.

Instance member ScaleTransform(sx, sy, order)

Scales the local geometric transformation of this LinearGradientBrush object by the specified amounts in the specified order.

ParameterTypeDescription
sxSingleThe amount by which to scale the transformation in the x direction.
sySingleThe amount by which to scale the transformation in the y direction.
orderMatrixOrderA MatrixOrder enumeration that specifies whether to append or prepend the scaling matrix.

Instance member SetBlendTriangularShape(focus)

Creates a linear gradient with a center color and a linear falloff to a single color on both ends.

ParameterTypeDescription
focusSingleA value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).

Instance member SetBlendTriangularShape(focus, scale)

Creates a linear gradient with a center color and a linear falloff to a single color on both ends.

ParameterTypeDescription
focusSingleA value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).
scaleSingleA value from 0 through1 that specifies how fast the colors falloff from the starting color to focus (ending color)

Instance member SetSigmaBellShape(focus)

Creates a gradient falloff based on a bell-shaped curve.

ParameterTypeDescription
focusSingleA value from 0 through 1 that specifies the center of the gradient (the point where the starting color and ending color are blended equally).

Instance member SetSigmaBellShape(focus, scale)

Creates a gradient falloff based on a bell-shaped curve.

ParameterTypeDescription
focusSingleA value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).
scaleSingleA value from 0 through 1 that specifies how fast the colors falloff from the focus .

Instance member TranslateTransform(dx, dy)

Translates the local geometric transformation of this LinearGradientBrush object by the specified dimensions. This method prepends the translation to the transformation.

ParameterTypeDescription
dxSingleThe dimension by which to translate the transformation in the x direction.
dySingleThe dimension by which to translate the transformation in the y direction.

Instance member TranslateTransform(dx, dy, order)

Translates the local geometric transformation of this LinearGradientBrush object by the specified dimensions in the specified order.

ParameterTypeDescription
dxSingleThe dimension by which to translate the transformation in the x direction.
dySingleThe dimension by which to translate the transformation in the y direction.
orderMatrixOrderThe order (prepend or append) in which to apply the translation.