LinearGradient Class
Represents a simple linear gradient.
public abstract class LinearGradient : Gradient, ICloneable
- Inheritance:
- object BackgroundFill Gradient object
- Implements:
- ICloneable
Constructors
LinearGradient()
Initializes an instance of the class.
protected LinearGradient()
LinearGradient(LinearGradient)
Initializes an instance of the class.
protected LinearGradient(LinearGradient copyFrom)
| Parameter | Type | Description |
|---|---|---|
| copyFrom | LinearGradient | An instance of LinearGradient which will be copied to initialize the new instance. |
Remarks
This constructor used in support of Clone() for base classes to initialize their fields.
LinearGradient(Color, Color)
Initializes an instance of the class.
protected LinearGradient(Color startColor, Color endColor)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start color of the gradient. |
| endColor | Color | The end color of the gradient. |
LinearGradient(Color, Color, float)
Initializes an instance of the class.
protected LinearGradient(Color startColor, Color endColor, float angle)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start 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. |
LinearGradient(Color, Color, float, BackgroundFillRotationType)
Initializes an instance of the class.
protected LinearGradient(Color startColor, Color endColor, float angle, BackgroundFillRotationType rotationType)
| Parameter | Type | Description |
|---|---|---|
| startColor | Color | The start 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
Angle
The angle, measured in degrees clockwise from the x-axis, that defines the orientation of the gradient.
EndColor
The end color of the gradient.
EndColorAlpha
The end color alpha value.
RotationType
The type of rotation to perform when drawing the background fill for a side.
public BackgroundFillRotationType RotationType { get; set; }
Property Value
Remarks
The default drawing side is Top.
StartColor
The start color of the gradient.
StartColorAlpha
The start color alpha value.
Methods
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.
GetHashCode()
Serves as the default hash function.
ResetAngle()
Resets the Angle property to its default value.
public virtual void ResetAngle()
ResetEndColor()
Resets the EndColor property to its default value.
public virtual void ResetEndColor()
ResetRotationType()
Resets the RotationType property to its default value.
public virtual void ResetRotationType()
ResetStartColor()
Resets the StartColor property to its default value.
public virtual void ResetStartColor()
ShouldSerializeAngle()
Indicates whether the Angle property should be persisted.
public virtual bool ShouldSerializeAngle()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeEndColor()
Indicates whether the EndColor property should be persisted.
public virtual bool ShouldSerializeEndColor()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeRotationType()
Indicates whether the RotationType property should be persisted.
public virtual bool ShouldSerializeRotationType()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeStartColor()
Indicates whether the StartColor property should be persisted.
public virtual bool ShouldSerializeStartColor()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
Inherited Members
- BackgroundFill.Clone()
- 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.DrawScaled(Graphics, Rectangle, Rectangle, Sides, SizeF)
- BackgroundFill.GetBrush(Rectangle, Sides)
- BackgroundFill.OnPropertyChanged(EventArgs)
- BackgroundFill.PropertyChanged
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)