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

public float Angle { get; set; }

Property Value

float

EndColor

The end color of the gradient.

public Color EndColor { get; set; }

Property Value

Color

EndColorAlpha

The end color alpha value.

public byte EndColorAlpha { get; set; }

Property Value

byte

RotationType

The type of rotation to perform when drawing the background fill for a side.

public BackgroundFillRotationType RotationType { get; set; }

Property Value

BackgroundFillRotationType

Remarks

The default drawing side is Top.

StartColor

The start color of the gradient.

public Color StartColor { get; set; }

Property Value

Color

StartColorAlpha

The start color alpha value.

public byte StartColorAlpha { get; set; }

Property Value

byte

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:

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

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int:

A hash code for the current 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

Extension Methods