In This Article

LinearGradient Class

Represents a simple linear gradient.

public abstract class LinearGradient : Gradient, ICloneable
Inheritance:
object BackgroundFill Gradient object
Derived:
MultiColorLinearGradient TwoColorLinearGradient
Implements:
ICloneable

Constructors

LinearGradient()

Initializes a new instance of the LinearGradient class.

protected LinearGradient()

Remarks

The default constructor initializes all fields to their default values.

LinearGradient(LinearGradient)

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

Gets or sets the angle, measured in degrees clockwise from the x-axis, that defines the orientation of the gradient.

public float Angle { get; set; }

Property Value

float:

The angle, measured in degrees clockwise from the x-axis, that defines the orientation of the gradient.

EndColor

Gets or sets the end color of the gradient.

public Color EndColor { get; set; }

Property Value

Color:

A Color object containing the end color.

EndColorAlpha

Gets or sets the end color alpha value.

public byte EndColorAlpha { get; set; }

Property Value

byte:

The end color alpha value.

RotationType

Gets or sets the type of rotation to perform when drawing the background fill for a side.

public BackgroundFillRotationType RotationType { get; set; }

Property Value

BackgroundFillRotationType:

A BackgroundFillRotationType indicating the type of rotation to perform when drawing the background fill for a side.

Remarks

The default drawing side is Top.

StartColor

Gets or sets the start color of the gradient.

public Color StartColor { get; set; }

Property Value

Color:

A Color object containing the start color.

StartColorAlpha

Gets or sets the start color alpha value.

public byte StartColorAlpha { get; set; }

Property Value

byte:

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

Returns

bool:

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

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.

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:

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

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

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

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

Inherited Members