In This Article

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 a new instance of the TwoColorLinearGradient class.

public TwoColorLinearGradient()

Remarks

The default constructor initializes all fields to their default values.

TwoColorLinearGradient(TwoColorLinearGradient)

Initializes a new instance of the TwoColorLinearGradient 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 a new instance of the TwoColorLinearGradient 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 a new instance of the TwoColorLinearGradient 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 a new instance of the TwoColorLinearGradient 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 a new instance of the TwoColorLinearGradient 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

Gets or sets the gradient focus.

public float Focus { get; set; }

Property Value

float:

The gradient focus.

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

Gets or sets the gradient scale.

public float Scale { get; set; }

Property Value

float:

The gradient scale.

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

Gets or sets the style of the gradient.

public TwoColorLinearGradientStyle Style { get; set; }

Property Value

TwoColorLinearGradientStyle:

A TwoColorLinearGradientStyle object containing the style of the gradient.

Methods

Clone()

Creates an exact duplicate of the TwoColorLinearGradient object.

public override BackgroundFill Clone()

Returns

BackgroundFill:

An exact duplicate of the TwoColorLinearGradient 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 Graphics object used to paint.

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 Graphics object used to paint.

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 Graphics object used to paint.

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 Graphics object used to paint.

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 gradient.

public override void DrawScaled(Graphics g, Rectangle bounds, Rectangle gradientBounds, Sides side, SizeF scaleFactor)
Parameter Type Description
g Graphics

The Graphics object used to paint.

bounds Rectangle

The bounds of the area to paint.

gradientBounds Rectangle

The bounds of the gradient effect.

side Sides

The side with which the background fill should be oriented.

scaleFactor SizeF

(Unused) 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 to the current Object.

Returns

bool:

true if the specified Object is equal to the current Object; otherwise, false.

GetBrush(Rectangle, Sides)

Gets 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

Brush:

A Brush that represents the background fill.

GetHashCode()

Returns a hash code for this object.

public override int GetHashCode()

Returns

int:

An integer value that specifies a hash value for this object.

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:

true if 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:

true if 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:

true if the property value has changed from its default; otherwise, false.

Inherited Members