Class LinearGradientBrush
Encapsulates a Brush with a linear gradient. This class cannot be inherited.
public sealed class LinearGradientBrush : LinearGradientBrushBase, IDisposable
- Inheritance
-
LinearGradientBrush
- Implements
- Inherited Members
Constructors
LinearGradientBrush()
Initializes a new instance of the LinearGradientBrush class with default parameters. The starting color is black, the ending color is white, the angle is 45 degrees and the rectangle is located in (0,0) with size (1,1).
public LinearGradientBrush()
LinearGradientBrush(Point, Point, Color, Color)
Initializes a new instance of the LinearGradientBrush class.
public LinearGradientBrush(Point point1, Point point2, Color color1, Color color2)
Parameters
LinearGradientBrush(PointF, PointF, Color, Color)
Initializes a new instance of the LinearGradientBrush class.
public LinearGradientBrush(PointF point1, PointF point2, Color color1, Color color2)
Parameters
point1
PointFThe point1.
point2
PointFThe point2.
color1
ColorThe color1.
color2
ColorThe color2.
LinearGradientBrush(Rectangle, Color, Color, float)
Initializes a new instance of the LinearGradientBrush class.
public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle)
Parameters
rect
RectangleThe rectangle.
color1
ColorThe color1.
color2
ColorThe color2.
angle
floatThe angle.
LinearGradientBrush(Rectangle, Color, Color, float, bool)
Initializes a new instance of the LinearGradientBrush class.
public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle, bool isAngleScalable)
Parameters
rect
RectangleThe rectangle.
color1
ColorThe color1.
color2
ColorThe color2.
angle
floatThe angle.
isAngleScalable
boolif set to
true
[is angle scalable].
LinearGradientBrush(RectangleF, Color, Color, float)
Initializes a new instance of the LinearGradientBrush class.
public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle)
Parameters
rect
RectangleFThe rectangle.
color1
ColorThe color1.
color2
ColorThe color2.
angle
floatThe angle.
LinearGradientBrush(RectangleF, Color, Color, float, bool)
Initializes a new instance of the LinearGradientBrush class.
public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle, bool isAngleScalable)
Parameters
rect
RectangleFThe rectangle.
color1
ColorThe color1.
color2
ColorThe color2.
angle
floatThe angle.
isAngleScalable
boolif set to
true
[is angle scalable].
Properties
Blend
Gets or sets a Blend that specifies positions and factors that define a custom falloff for the gradient.
public Blend Blend { get; set; }
Property Value
EndColor
Gets or sets the ending gradient color.
public Color EndColor { get; set; }
Property Value
- Color
The ending gradient color.
InterpolationColors
Gets or sets a ColorBlend that defines a multicolor linear gradient.
[Obsolete("This property is not used anymore in this class. Use instance of the LinearMulticolorGradientBrush class instead.")]
public ColorBlend InterpolationColors { get; set; }
Property Value
- ColorBlend
A ColorBlend that defines a multicolor linear gradient.
LinearColors
Gets or sets the starting and ending colors of the gradient.
[Obsolete("Use StartColor and EndColor properties instead.")]
public Color[] LinearColors { get; set; }
Property Value
- Color[]
An array of two Color structures that represents the starting and ending colors of the gradient.
StartColor
Gets or sets the starting gradient color.
public Color StartColor { get; set; }
Property Value
- Color
The starting gradient color.
Methods
SetBlendTriangularShape(float)
Creates a linear gradient with a center color and a linear falloff to a single color on both ends.
public void SetBlendTriangularShape(float focus)
Parameters
focus
floatA value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).
SetBlendTriangularShape(float, float)
Creates a linear gradient with a center color and a linear falloff to a single color on both ends.
public void SetBlendTriangularShape(float focus, float scale)
Parameters
focus
floatA value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).
scale
floatA value from 0 through1 that specifies how fast the colors falloff from the starting color to
focus
(ending color)
SetSigmaBellShape(float)
Creates a gradient falloff based on a bell-shaped curve.
public void SetSigmaBellShape(float focus)
Parameters
focus
floatA value from 0 through 1 that specifies the center of the gradient (the point where the starting color and ending color are blended equally).
SetSigmaBellShape(float, float)
Creates a gradient falloff based on a bell-shaped curve.
public void SetSigmaBellShape(float focus, float scale)