GradientStopCollection Class
Represents a collection of gradient stops in a gradient fill.
public class GradientStopCollection : Collection<GradientStop>, IList, ICollection, IList<GradientStop>, ICollection<GradientStop>, IEnumerable<GradientStop>, IEnumerablePublic Class GradientStopCollection
Inherits Collection(Of GradientStop)
Implements IList, ICollection, IList(Of GradientStop), ICollection(Of GradientStop), IEnumerable(Of GradientStop), IEnumerable- Inheritance:
- System.ObjectGradientStopCollection
Implements
Properties
Count
Gets the number of GradientStops contained in the collection.
Property Value
- System.Int32
The number of GradientStops contained in the collection.
Item[Int32]
Gets or sets the GradientStop at the specified index.
public GradientStop this[int index] { get; set; }Public Property Item(index As Integer) As GradientStopParameters
index- System.Int32
The zero-based index of the GradientStop to get or set.
Property Value
The GradientStop at the specified index.
Exceptions
- System.ArgumentOutOfRangeException
index is less than zero or index is equal to or greater than Count.
Methods
Add(GradientStop)
Adds a GradientStop to the end of the collection.
Parameters
item- GradientStop
The GradientStop to be added to the end of the collection.
Exceptions
- System.ArgumentNullException
item is null.
AddNew(Double, Color)
Adds a new gradient stop.
public GradientStop AddNew(double position, Color color)Public Function AddNew(position As Double, color As Color) As GradientStopParameters
position- System.Double
The position of the gradient stop expressed as a percentage from 0 to 1.
color- Color
The color of the gradient stop.
Returns
A newly added gradient stop.
Clear()
Removes all GradientStops from the collection.
Contains(GradientStop)
Determines whether a GradientStop is in the collection.
public bool Contains(GradientStop item)Public Function Contains(item As GradientStop) As BooleanParameters
item- GradientStop
The GradientStop to locate in the collection.
Returns
- System.Boolean
true if item is found in the collection; otherwise, false.
Exceptions
- System.ArgumentNullException
item is null.
GetEnumerator()
Returns an enumerator that iterates through the GradientStopCollection.
public IEnumerator<GradientStop> GetEnumerator()Public Function GetEnumerator As IEnumerator(Of GradientStop)Returns
- System.Collections.Generic.IEnumerator<GradientStop>
An System.Collections.Generic.IEnumerator<T> for the collection.
IndexOf(GradientStop)
Searches for the specified GradientStop and returns the zero-based index of the first occurrence within the entire collection.
public int IndexOf(GradientStop item)Public Function IndexOf(item As GradientStop) As IntegerParameters
item- GradientStop
The GradientStop to locate in the collection.
Returns
- System.Int32
The zero-based index of the first occurrence of item within the entire collection, if found; otherwise, -1.
Insert(Int32, GradientStop)
Inserts a GradientStop to the collection at the specified index.
public void Insert(int index, GradientStop item)Public Sub Insert(index As Integer, item As GradientStop)Parameters
index- System.Int32
The zero-based index at which GradientStop should be inserted.
item- GradientStop
The GradientStop to insert into the collection.
Exceptions
- System.ArgumentOutOfRangeException
index is less than zero or index is equal to or greater than Count.
InsertNew(Int32, Double, Color)
Inserts a new gradient stop with the specified name at the specified index.
public GradientStop InsertNew(int index, double position, Color color)Public Function InsertNew(index As Integer, position As Double, color As Color) As GradientStopParameters
index- System.Int32
The position in the collection where the new gradient stop should be inserted.
position- System.Double
The position of the gradient stop expressed as a percentage from 0 to 1.
color- Color
The color of the gradient stop.
Returns
A newly inserted gradient stop.
Exceptions
- System.ArgumentOutOfRangeException
index is less than 0 or greater than Count.
Remove(GradientStop)
Removes the first occurrence of a specific GradientStop from the collection.
public bool Remove(GradientStop item)Public Function Remove(item As GradientStop) As BooleanParameters
item- GradientStop
The GradientStop to remove from the collection.
Returns
- System.Boolean
true if item is successfully removed; otherwise, false. This method also returns false if item was not found in the original collection.
RemoveAt(Int32)
Removes the GradientStop at the specified index of the collection.
Parameters
index- System.Int32
The zero-based index of the GradientStop to remove.
Exceptions
- System.ArgumentOutOfRangeException
index is less than zero or index is equal to or greater than Count.