MultiColorLinearGradient Class
Represents a multi-color linear gradient.
public class MultiColorLinearGradient : LinearGradient, ICloneable
- Inheritance:
- object BackgroundFill Gradient LinearGradient object
- Implements:
- ICloneable
Constructors
MultiColorLinearGradient()
Initializes an instance of the class.
public MultiColorLinearGradient()
Remarks
The default constructor initializes all fields to their default values.
MultiColorLinearGradient(MultiColorLinearGradient)
Initializes an instance of the class.
protected MultiColorLinearGradient(MultiColorLinearGradient copyFrom)
| Parameter | Type | Description |
|---|---|---|
| copyFrom | MultiColorLinearGradient | An instance of MultiColorLinearGradient which will be copied to initialize the new instance. |
Remarks
This constructor used in support of Clone() for base classes to initialize their fields.
MultiColorLinearGradient(Color, LinearGradientColorPosition[], Color, float, BackgroundFillRotationType)
Initializes an instance of the class.
public MultiColorLinearGradient(Color startColor, LinearGradientColorPosition[] intermediateColors, Color endColor, float angle, BackgroundFillRotationType rotationType)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start color of the gradient. |
| intermediateColors | LinearGradientColorPosition[] | The intermediate colors of the gradient. |
| endColor | Color | The end color of the gradient. |
| angle | float | The angle, measured in degrees clockwise from the x-axis, that defines the orientation of the gradient. |
| rotationType | BackgroundFillRotationType | The type of rotation to perform when drawing the background fill for a side. |
MultiColorLinearGradient(Color, Color, Color, float)
Initializes an instance of the class.
public MultiColorLinearGradient(Color startColor, Color middleColor, Color endColor, float angle)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start color of the gradient. |
| middleColor | Color | The middle color of the gradient. |
| endColor | Color | The end color of the gradient. |
| angle | float | The angle, measured in degrees clockwise from the x-axis, that defines the orientation of the gradient. |
MultiColorLinearGradient(Color, Color, Color, float, BackgroundFillRotationType)
Initializes an instance of the class.
public MultiColorLinearGradient(Color startColor, Color middleColor, Color endColor, float angle, BackgroundFillRotationType rotationType)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start color of the gradient. |
| middleColor | Color | The middle color of the gradient. |
| endColor | Color | The end color of the gradient. |
| angle | float | The angle, measured in degrees clockwise from the x-axis, that defines the orientation of the gradient. |
| rotationType | BackgroundFillRotationType | The type of rotation to perform when drawing the background fill for a side. |
Properties
IntermediateColors
The intermediate colors of the gradient.
[TypeConverter(typeof(LinearGradientColorPositionArrayConverter))]
public LinearGradientColorPosition[]? IntermediateColors { get; set; }
Property Value
- LinearGradientColorPosition[]:
An array of LinearGradientColorPosition objects containing the intermediate colors.
Methods
Clone()
Creates an exact duplicate of the BackgroundFill object.
Draw(Graphics, Rectangle, Rectangle, Color, LinearGradientColorPosition[]?, Color, float)
Fills an area with the gradient.
public static void Draw(Graphics g, Rectangle bounds, Rectangle gradientBounds, Color startColor, LinearGradientColorPosition[]? intermediateColors, Color endColor, float angle)
| Parameter | Type | Description |
|---|---|---|
| g | Graphics | The |
| bounds | Rectangle | The bounds of the area to paint. |
| gradientBounds | Rectangle | The bounds of the gradient effect. |
| startColor | Color | The start color of the gradient. |
| intermediateColors | LinearGradientColorPosition[] | The intermediate colors of the gradient. |
| endColor | Color | The end color of the gradient. |
| angle | float | The angle, measured in degrees clockwise from the x-axis, that defines the orientation of the gradient. |
Draw(Graphics, Rectangle, Rectangle, Color, Color, Color, float)
Fills an area with the gradient.
public static void Draw(Graphics g, Rectangle bounds, Rectangle gradientBounds, Color startColor, Color middleColor, Color endColor, float angle)
| Parameter | Type | Description |
|---|---|---|
| g | Graphics | The |
| bounds | Rectangle | The bounds of the area to paint. |
| gradientBounds | Rectangle | The bounds of the gradient effect. |
| startColor | Color | The start color of the gradient. |
| middleColor | Color | The middle color of the gradient. |
| endColor | Color | The end color of the gradient. |
| angle | float | The angle, measured in degrees clockwise from the x-axis, that defines the orientation of the gradient. |
DrawScaled(Graphics, Rectangle, Rectangle, Sides, SizeF)
Fills an area with the background fill.
public override void DrawScaled(Graphics g, Rectangle bounds, Rectangle gradientBounds, Sides side, SizeF scaleFactor)
| Parameter | Type | Description |
|---|---|---|
| g | Graphics | The |
| bounds | Rectangle | The bounds of the area to paint. |
| gradientBounds | Rectangle | The |
| side | Sides | The side with which the background fill should be oriented. |
| scaleFactor | SizeF | The factor of the scale transform to be applied where Width is applied to the x-axis, and Height is applied to the y-axis. |
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
| Parameter | Type | Description |
|---|---|---|
| obj | object | The object to compare with the current object. |
Returns
- bool:
trueif the specified object is equal to the current object; otherwise,false.
GetBrush(Rectangle, Sides)
Returns a Brush that represents the background fill.
public override Brush GetBrush(Rectangle bounds, Sides side)
| Parameter | Type | Description |
|---|---|---|
| bounds | Rectangle | The bounds of the area to paint. |
| side | Sides | The side with which the background fill should be oriented. |
Returns
GetHashCode()
Serves as the default hash function.
ResetIntermediateColors()
Resets the IntermediateColors property to its default value.
public virtual void ResetIntermediateColors()
ShouldSerializeIntermediateColors()
Indicates whether the IntermediateColors property should be persisted.
public virtual bool ShouldSerializeIntermediateColors()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
Inherited Members
- LinearGradient.ResetAngle()
- LinearGradient.ShouldSerializeAngle()
- LinearGradient.ResetEndColor()
- LinearGradient.ShouldSerializeEndColor()
- LinearGradient.ResetRotationType()
- LinearGradient.ShouldSerializeRotationType()
- LinearGradient.ResetStartColor()
- LinearGradient.ShouldSerializeStartColor()
- LinearGradient.Angle
- LinearGradient.EndColor
- LinearGradient.EndColorAlpha
- LinearGradient.RotationType
- LinearGradient.StartColor
- LinearGradient.StartColorAlpha
- BackgroundFill.Draw(Graphics, Rectangle)
- BackgroundFill.Draw(Graphics, Rectangle, Rectangle)
- BackgroundFill.Draw(Graphics, Rectangle, Sides)
- BackgroundFill.Draw(Graphics, Rectangle, Rectangle, Sides)
- BackgroundFill.DrawScaled(Graphics, Rectangle, SizeF)
- BackgroundFill.DrawScaled(Graphics, Rectangle, Rectangle, SizeF)
- BackgroundFill.DrawScaled(Graphics, Rectangle, Sides, SizeF)
- BackgroundFill.OnPropertyChanged(EventArgs)
- BackgroundFill.PropertyChanged
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)