In This Article

LinearGradientColorPosition Class

Provides color and position information for a linear gradient.

[TypeConverter(typeof(LinearGradientColorPositionConverter))]
public class LinearGradientColorPosition : ICloneable
Inheritance:
object object
Implements:
ICloneable

Constructors

LinearGradientColorPosition()

Initializes an instance of the class.

public LinearGradientColorPosition()

LinearGradientColorPosition(LinearGradientColorPosition)

Initializes an instance of the class.

protected LinearGradientColorPosition(LinearGradientColorPosition copyFrom)
Parameter Type Description
copyFrom LinearGradientColorPosition

An instance of LinearGradientColorPosition which will be copied to initialize the new instance.

Remarks

This constructor used in support of Clone().

LinearGradientColorPosition(Color, float)

Initializes an instance of the class.

public LinearGradientColorPosition(Color color, float position)
Parameter Type Description
color Color

The color of the gradient step.

position float

The percentage of distance along the gradient line.

Properties

Color

The color of the gradient step.

public virtual Color Color { get; set; }

Property Value

Color

ColorAlpha

The color alpha value.

public virtual byte ColorAlpha { get; set; }

Property Value

byte

Position

The percentage of distance along the gradient line.

public virtual float Position { get; set; }

Property Value

float:

This value is a decimal between 0 and 1.

Methods

Clone()

Creates a new object that is a copy of the current instance.

public object Clone()

Returns

object:

A new object that is a copy of this instance.

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.

OnPropertyChanged(EventArgs)

Raises the PropertyChanged event.

protected virtual void OnPropertyChanged(EventArgs e)
Parameter Type Description
e EventArgs

The event data.

ResetColor()

Resets the Color property to its default value.

public virtual void ResetColor()

ResetPosition()

Resets the Position property to its default value.

public virtual void ResetPosition()

ShouldSerializeColor()

Indicates whether the Color property should be persisted.

public virtual bool ShouldSerializeColor()

Returns

bool:

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

ShouldSerializePosition()

Indicates whether the Position property should be persisted.

public virtual bool ShouldSerializePosition()

Returns

bool:

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

Events

PropertyChanged

Occurs after a property is changed.

public event EventHandler? PropertyChanged

Event Type

EventHandler

Inherited Members

Extension Methods