TwoColorLinearGradient Class
Represents a two color linear gradient.
[TypeConverter(typeof(TwoColorLinearGradientConverter))]
public class TwoColorLinearGradient : LinearGradient, ICloneable
- Inheritance:
- object BackgroundFill Gradient LinearGradient object
- Implements:
- ICloneable
Constructors
TwoColorLinearGradient()
Initializes an instance of the class.
public TwoColorLinearGradient()
TwoColorLinearGradient(TwoColorLinearGradient)
Initializes an instance of the class.
protected TwoColorLinearGradient(TwoColorLinearGradient copyFrom)
| Parameter | Type | Description |
|---|---|---|
| copyFrom | TwoColorLinearGradient | An instance of TwoColorLinearGradient which will be copied to initialize the new instance. |
Remarks
This constructor used in support of Clone() for base classes to initialize their fields.
TwoColorLinearGradient(Color, Color, float, TwoColorLinearGradientStyle)
Initializes an instance of the class.
public TwoColorLinearGradient(Color startColor, Color endColor, float angle, TwoColorLinearGradientStyle style)
| 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. |
| style | TwoColorLinearGradientStyle | The style of the gradient. |
TwoColorLinearGradient(Color, Color, float, TwoColorLinearGradientStyle, BackgroundFillRotationType)
Initializes an instance of the class.
public TwoColorLinearGradient(Color startColor, Color endColor, float angle, TwoColorLinearGradientStyle style, 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. |
| style | TwoColorLinearGradientStyle | The style of the gradient. |
| rotationType | BackgroundFillRotationType | The type of rotation to perform when drawing the background fill for a side. |
TwoColorLinearGradient(Color, Color, float, TwoColorLinearGradientStyle, float, float)
Initializes an instance of the class.
public TwoColorLinearGradient(Color startColor, Color endColor, float angle, TwoColorLinearGradientStyle style, float focus, float scale)
| 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. |
| style | TwoColorLinearGradientStyle | The style of the gradient. |
| focus | float | The gradient focus. |
| scale | float | The gradient scale. |
TwoColorLinearGradient(Color, Color, float, TwoColorLinearGradientStyle, float, float, BackgroundFillRotationType)
Initializes an instance of the class.
public TwoColorLinearGradient(Color startColor, Color endColor, float angle, TwoColorLinearGradientStyle style, float focus, float scale, 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. |
| style | TwoColorLinearGradientStyle | The style of the gradient. |
| focus | float | The gradient focus. |
| scale | float | The gradient scale. |
| rotationType | BackgroundFillRotationType | The type of rotation to perform when drawing the background fill for a side. |
Properties
Focus
The gradient focus.
public float Focus { get; set; }
Property Value
Remarks
This value is used to determine the center point of triangle and bell-shaped gradients.
It's value should be a decimal between 0 and 1.
Scale
The gradient scale.
public float Scale { get; set; }
Property Value
Remarks
This value is used to determine how fast the colors falloff from the focus in triangle and bell-shaped gradients.
It's value should be a decimal between 0 and 1.
Style
The style of the gradient.
Methods
Clone()
Creates an exact duplicate of the BackgroundFill object.
Draw(Graphics, GraphicsPath, Rectangle, Color, Color, float, TwoColorLinearGradientStyle)
Fills an area with the gradient.
public static void Draw(Graphics g, GraphicsPath path, Rectangle gradientBounds, Color startColor, Color endColor, float angle, TwoColorLinearGradientStyle style)
| Parameter | Type | Description |
|---|---|---|
| g | Graphics | The |
| path | GraphicsPath | The bounds of the area to paint. |
| gradientBounds | Rectangle | The bounds of the gradient effect. |
| 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. |
| style | TwoColorLinearGradientStyle | The style of the gradient. |
Draw(Graphics, GraphicsPath, Rectangle, Color, Color, float, TwoColorLinearGradientStyle, float, float)
Fills an area with the gradient.
public static void Draw(Graphics g, GraphicsPath path, Rectangle gradientBounds, Color startColor, Color endColor, float angle, TwoColorLinearGradientStyle style, float focus, float scale)
| Parameter | Type | Description |
|---|---|---|
| g | Graphics | The |
| path | GraphicsPath | The bounds of the area to paint. |
| gradientBounds | Rectangle | The bounds of the gradient effect. |
| 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. |
| style | TwoColorLinearGradientStyle | The style of the gradient. |
| focus | float | The gradient focus. |
| scale | float | The gradient scale. |
Draw(Graphics, Rectangle, Rectangle, Color, Color, float, TwoColorLinearGradientStyle)
Fills an area with the gradient.
public static void Draw(Graphics g, Rectangle bounds, Rectangle gradientBounds, Color startColor, Color endColor, float angle, TwoColorLinearGradientStyle style)
| 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. |
| 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. |
| style | TwoColorLinearGradientStyle | The style of the gradient. |
Draw(Graphics, Rectangle, Rectangle, Color, Color, float, TwoColorLinearGradientStyle, float, float)
Fills an area with the gradient.
public static void Draw(Graphics g, Rectangle bounds, Rectangle gradientBounds, Color startColor, Color endColor, float angle, TwoColorLinearGradientStyle style, float focus, float scale)
| 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. |
| 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. |
| style | TwoColorLinearGradientStyle | The style of the gradient. |
| focus | float | The gradient focus. |
| scale | float | The gradient scale. |
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.
ResetFocus()
Resets the Focus property to its default value.
public virtual void ResetFocus()
ResetScale()
Resets the Scale property to its default value.
public virtual void ResetScale()
ResetStyle()
Resets the Style property to its default value.
public virtual void ResetStyle()
ShouldSerializeFocus()
Indicates whether the Focus property should be persisted.
public virtual bool ShouldSerializeFocus()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeScale()
Indicates whether the Focus property should be persisted.
public virtual bool ShouldSerializeScale()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeStyle()
Indicates whether the Style property should be persisted.
public virtual bool ShouldSerializeStyle()
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)