In This Article

MultiColorLinearGradient Class

Represents a multi-color linear gradient.

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

Constructors

MultiColorLinearGradient()

Initializes a new instance of the MultiColorLinearGradient class.

public MultiColorLinearGradient()

Remarks

The default constructor initializes all fields to their default values.

MultiColorLinearGradient(MultiColorLinearGradient)

Initializes a new instance of the MultiColorLinearGradient class.

protected MultiColorLinearGradient(MultiColorLinearGradient copyFrom)
Parameter Type Description
copyFrom MultiColorLinearGradient

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

Remarks

This constructor used in support of Clone() for base classes to initialize their fields.

MultiColorLinearGradient(Color, LinearGradientColorPosition[], Color, float, BackgroundFillRotationType)

Initializes a new instance of the MultiColorLinearGradient class.

public MultiColorLinearGradient(Color startColor, LinearGradientColorPosition[] intermediateColors, Color endColor, float angle, BackgroundFillRotationType rotationType)
Parameter Type Description
startColor Color

The start color of the gradient.

intermediateColors LinearGradientColorPosition[]

The intermediate colors 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.

MultiColorLinearGradient(Color, Color, Color, float)

Initializes a new instance of the MultiColorLinearGradient class.

public MultiColorLinearGradient(Color startColor, Color middleColor, Color endColor, float angle)
Parameter Type Description
startColor Color

The start color of the gradient.

middleColor Color

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

MultiColorLinearGradient(Color, Color, Color, float, BackgroundFillRotationType)

Initializes a new instance of the MultiColorLinearGradient class.

public MultiColorLinearGradient(Color startColor, Color middleColor, Color endColor, float angle, BackgroundFillRotationType rotationType)
Parameter Type Description
startColor Color

The start color of the gradient.

middleColor Color

The middle 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

IntermediateColors

Gets or sets the intermediate colors of the gradient.

[TypeConverter(typeof(LinearGradientColorPositionArrayConverter))]
public LinearGradientColorPosition[] IntermediateColors { get; set; }

Property Value

LinearGradientColorPosition[]:

An array of LinearGradientColorPosition objects containing the intermediate colors.

Methods

Clone()

Creates an exact duplicate of the MultiColorLinearGradient object.

public override BackgroundFill Clone()

Returns

BackgroundFill:

An exact duplicate of the MultiColorLinearGradient object.

Draw(Graphics, Rectangle, Rectangle, Color, LinearGradientColorPosition[], Color, float)

Fills an area with the gradient.

public static void Draw(Graphics g, Rectangle bounds, Rectangle gradientBounds, Color startColor, LinearGradientColorPosition[] intermediateColors, Color endColor, float angle)
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.

intermediateColors LinearGradientColorPosition[]

The intermediate colors 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.

Draw(Graphics, Rectangle, Rectangle, Color, Color, Color, float)

Fills an area with the gradient.

public static void Draw(Graphics g, Rectangle bounds, Rectangle gradientBounds, Color startColor, Color middleColor, Color endColor, float angle)
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.

middleColor Color

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

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.

ResetIntermediateColors()

Resets the IntermediateColors property to its default value.

public virtual void ResetIntermediateColors()

ShouldSerializeIntermediateColors()

Indicates whether the IntermediateColors property should be persisted.

public virtual bool ShouldSerializeIntermediateColors()

Returns

bool:

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

Inherited Members