Interface IGradientStops
Represents a collection of IGradientStop instance.
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.NET.dll
Syntax
public interface IGradientStops : IEnumerable<IGradientStop>, IEnumerable
Properties
Count
Gets the number of elements in the gradient stop collection. Read-only.
Declaration
int Count { get; }
Property Value
Type |
---|
System.Int32 |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop to the gradient stops collection
gradientStops.Add();
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F);
//Create instance for gradient stop
IGradientStop gradStop = gradientStops.Add();
//Set position for gradient stop
gradStop.Position = 5F;
//Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(20, 106, 120);
//Get the count of gradient stops added, read only
int totalGradientStops = gradientStops.Count;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop to the gradient stops collection
gradientStops.Add()
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F)
'Create instance for gradient stop
Dim gradStop As IGradientStop = gradientStops.Add()
'Set position for gradient stop
gradStop.Position = 5F
'Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(20, 106, 120)
'Get the count of gradient stops added, read only
Dim totalGradientStops As Integer = gradientStops.Count
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Item[Int32]
Gets an IGradientStop instance at specified index from the gradient stop collection. Read-only.
Declaration
IGradientStop this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Determines the index of the gradient stop. |
Property Value
Type | Description |
---|---|
IGradientStop | The IGradientStop. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop to the gradient stops collection
gradientStops.Add();
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Blue, 75F);
//Gets a single gradient stop from the collection
IGradientStop gradStop = gradientStops[0];
//Set position for gradient stop
gradStop.Position = 25F;
//Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90);
//Add the gradient stop to collection
gradientStops.Add(gradStop);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop to the gradient stops collection
gradientStops.Add()
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Blue, 75F)
'Gets a single gradient stop from the collection
Dim gradStop As IGradientStop = gradientStops(0)
'Set position for gradient stop
gradStop.Position = 25F
'Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90)
'Add the gradient stop to collection
gradientStops.Add(gradStop)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Methods
Add()
Adds a gradient stop at the end of the collection.
Declaration
IGradientStop Add()
Returns
Type | Description |
---|---|
IGradientStop | Returns the IGradientStop instance. |
Remarks
Minimum of 2 gradient stops must be added while using gradient type fill.
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop to the gradient stops collection
gradientStops.Add();
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Blue, 1.1F);
//Gets a single gradient stop from the collection
IGradientStop gradStop = gradientStops[0];
//Set position for gradient stop
gradStop.Position = 2.4F;
//Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop to the gradient stops collection
gradientStops.Add()
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F)
'Gets a single gradient stop from the collection
Dim gradStop As IGradientStop = gradientStops(0)
'Set position for gradient stop
gradStop.Position = 2.4F
'Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Add(IColor, Single)
Adds a gradient stop at the specified position. Minimum of 2 gradient stops must be added while using gradient type fill.
Declaration
void Add(IColor rgb, float position)
Parameters
Type | Name | Description |
---|---|---|
IColor | rgb | The color of gradient stop. |
System.Single | position | The position of the gradient stop. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.LightBlue, 20F);
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 90.2F);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.LightBlue, 20F)
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 90.2F)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Add(IGradientStop)
Adds the specified gradient stop object at the end of the collection. Minimum of 2 gradient stops must be added while using gradient type fill.
Declaration
int Add(IGradientStop gradientStop)
Parameters
Type | Name | Description |
---|---|---|
IGradientStop | gradientStop | Represents an gradient stop instance to be added. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the zero-based index of the gradient stop object within collection. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop to the gradient stops collection
gradientStops.Add();
//Gets a single gradient stop from the collection
IGradientStop gradStop = gradientStops[0];
//Set position for gradient stop
gradStop.Position = 2.4F;
//Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90);
//Add the gradient stop to collection
gradientStops.Add(gradStop);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop to the gradient stops collection
gradientStops.Add()
'Gets a single gradient stop from the collection
Dim gradStop As IGradientStop = gradientStops(0)
'Set position for gradient stop
gradStop.Position = 2.4F
'Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90)
'Add the gradient stop to collection
gradientStops.Add(gradStop)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Clear()
Removes all the elements from gradient stop collection.
Declaration
void Clear()
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F);
//Add a gradient stop to the gradient stops collection
gradientStops.Add();
//Clears the collection
gradientStops.Clear();
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F)
'Add a gradient stop to the gradient stops collection
gradientStops.Add()
'Clears the collection
gradientStops.Clear()
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
IndexOf(IGradientStop)
Returns the zero-based index of the first occurrence of the IGradientStop instance within the collection.
Declaration
int IndexOf(IGradientStop item)
Parameters
Type | Name | Description |
---|---|---|
IGradientStop | item | The IGradientStop instance to locate. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the zero-based index of the first occurrence of IGradientStop instance within the collection, if found; otherwise, –1. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop to the gradient stops collection
gradientStops.Add();
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F);
//Gets a single gradient stop from the collection
IGradientStop gradStop = gradientStops[0];
//Set position for gradient stop
gradStop.Position = 2.4F;
//Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90);
//Add the gradient stop to collection
gradientStops.Add(gradStop);
//Get the index of gradient stop from the collection
int index = gradientStops.IndexOf(gradStop);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop to the gradient stops collection
gradientStops.Add()
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F)
'Gets a single gradient stop from the collection
Dim gradStop As IGradientStop = gradientStops(0)
'Set position for gradient stop
gradStop.Position = 2.4F
'Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90)
'Add the gradient stop to collection
gradientStops.Add(gradStop)
'Get the index of gradient stop from the collection
Dim index As Integer = gradientStops.IndexOf(gradStop)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Insert(Int32, IGradientStop)
Inserts an IGradientStop item into the gradient stop collection at the specified index.
Declaration
void Insert(int index, IGradientStop item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index value to insert the specified gradient stop item. |
IGradientStop | item | The gradient stop item to insert. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F);
//Add a gradient stop to the gradient stops collection
IGradientStop gradStop = gradientStops.Add();
//Set position for gradient stop
gradStop.Position = 2.4F;
//Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90);
//Add the gradient stop to collection
gradientStops.Add(gradStop);
//Insert a gradient stop into the collection
gradientStops.Insert(1, gradStop);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F)
'Add a gradient stop to the gradient stops collection
Dim gradStop As IGradientStop = gradientStops.Add()
'Set position for gradient stop
gradStop.Position = 2.4F
'Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(23, 156, 90)
'Add the gradient stop to collection
gradientStops.Add(gradStop)
'Insert a gradient stop into the collection
gradientStops.Insert(1, gradStop)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Remove(IGradientStop)
Removes the first occurrence of a specified IGradientStop instance from the gradient stop collection.
Declaration
void Remove(IGradientStop item)
Parameters
Type | Name | Description |
---|---|---|
IGradientStop | item | The gradient stop instance to be removed from the collection. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop to the gradient stops collection
gradientStops.Add();
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F);
//Create instance for gradient stop
IGradientStop gradStop = gradientStops.Add();
//Set position for gradient stop
gradStop.Position = 5F;
//Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(20, 106, 120);
//Remove a gradient stop
gradientStops.Remove(gradStop);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop to the gradient stops collection
gradientStops.Add()
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F)
'Create instance for gradient stop
Dim gradStop As IGradientStop = gradientStops.Add()
'Set position for gradient stop
gradStop.Position = 5F
'Set color for gradient stop
gradStop.Color = ColorObject.FromArgb(20, 106, 120)
'Remove a gradient stop
gradientStops.Remove(gradStop)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
RemoveAt(Int32)
Removes the element at the specified index of the gradient stop collection.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index value to remove the specified gradient stop item. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient;
//Create instance to hold all the gradient stop
IGradientStops gradientStops = slide.Background.Fill.GradientFill.GradientStops;
//Add a gradient stop to the gradient stops collection
gradientStops.Add();
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F);
//Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.LightBlue, 75F);
//Remove the gradient stop from specific index
gradientStops.RemoveAt(0);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Set gradient fill to the slide background
slide.Background.Fill.FillType = FillType.Gradient
'Create instance to hold all the gradient stop
Dim gradientStops As IGradientStops = slide.Background.Fill.GradientFill.GradientStops
'Add a gradient stop to the gradient stops collection
gradientStops.Add()
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.Crimson, 1.1F)
'Add a gradient stop by specifying color and position
gradientStops.Add(ColorObject.LightBlue, 75F)
'Remove the gradient stop from specific index
gradientStops.RemoveAt(0)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()