Interface IFill
Represents the fill format options of the object.
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.UWP.dll
Syntax
public interface IFill
Remarks
A fill format can have a solid, gradient, pattern, texture type.
Properties
FillType
Gets or sets the FillType of the object.
Declaration
FillType FillType { get; set; }
Property Value
Type |
---|
FillType |
Examples
//Open a presentation.
IPresentation presentation = Presentation.Open("Template.pptx");
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add();
//Get the fill of slide background
IFill fill = slide.Background.Fill;
//Set the fill type
fill.FillType = FillType.Solid;
//Set the fill color
fill.SolidFill.Color = ColorObject.Red;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Open a presentation
Dim presentation__1 As IPresentation = Presentation.Open("Template.pptx")
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add()
'Get the fill of slide background
Dim fill As IFill = slide.Background.Fill
'Set the fill type
fill.FillType = FillType.Solid
'Set the fill color
fill.SolidFill.Color = ColorObject.Red
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
GradientFill
Gets an IGradientFill instance. Read-only.
Declaration
IGradientFill GradientFill { get; }
Property Value
Type | Description |
---|---|
IGradientFill | The gradient fill. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add shape to slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220);
//Retrieve fill from shape
IFill fill = shape.Fill;
//Set gradient fill to the shape
fill.FillType = FillType.Gradient;
//Retrieve the gradient fill from the shape
IGradientFill gradientFill = fill.GradientFill;
//Add the first gradient stop.
gradientFill.GradientStops.Add();
//Add the second gradient stop.
gradientFill.GradientStops.Add();
//Save the presentation
presentation.Save("GradientFill.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)
'Add shape to slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220)
'Retrieve fill from shape
Dim fill As IFill = shape.Fill
'Set gradient fill to the shape
fill.FillType = FillType.Gradient
'Retrieve the gradient fill from the shape
Dim gradientFill As IGradientFill = fill.GradientFill
'Add the first gradient stop.
gradientFill.GradientStops.Add()
'Add the second gradient stop.
gradientFill.GradientStops.Add()
'Save the presentation
presentation__1.Save("GradientFill.pptx")
'Close the presentation
presentation__1.Close()
PatternFill
Gets an IPatternFill instance. Read-only.
Declaration
IPatternFill PatternFill { get; }
Property Value
Type | Description |
---|---|
IPatternFill | The pattern fill. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add shape to slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220);
//Retrieve fill from shape
IFill fill = shape.Fill;
//Set pattern fill type to shape
fill.FillType = FillType.Pattern;
//Create instance to hold pattern fill properties
IPatternFill patternFill = fill.PatternFill;
//Set the pattern type
patternFill.Pattern = PatternFillType.DashedDownwardDiagonal;
//Set back color for the pattern
patternFill.BackColor = ColorObject.PaleGreen;
//Set fore color for the pattern
patternFill.ForeColor = ColorObject.Blue;
//Save the presentation
presentation.Save("PatternFill.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)
'Add shape to slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220)
'Retrieve fill from shape
Dim fill As IFill = shape.Fill
'Set pattern fill type to shape
fill.FillType = FillType.Pattern
'Create instance to hold pattern fill properties
Dim patternFill As IPatternFill = fill.PatternFill
'Set the pattern type
patternFill.Pattern = PatternFillType.DashedDownwardDiagonal
'Set back color for the pattern
patternFill.BackColor = ColorObject.PaleGreen
'Set fore color for the pattern
patternFill.ForeColor = ColorObject.Blue
'Save the presentation
presentation__1.Save("PatternFill.pptx")
'Close the presentation
presentation__1.Close()
PictureFill
Gets an IPictureFill instance. Read-only.
Declaration
IPictureFill PictureFill { get; }
Property Value
Type | Description |
---|---|
IPictureFill | The picture fill. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220);
//Retrieve fill from the shape
IFill fill = shape.Fill;
//Set the picture fill type to shape
fill.FillType = FillType.Picture;
//Create an instance to hold the picture fill properties
IPictureFill pictureFill = fill.PictureFill;
//Create a file stream and copy it to the memory stream
FileStream pictureStream = new FileStream("Image.png", FileMode.Open);
MemoryStream memoryStream = new MemoryStream();
pictureStream.CopyTo(memoryStream);
//Convert the memory stream into a byte array
byte[] picBytes = memoryStream.ToArray();
//Set Image Bytes
pictureFill.ImageBytes = picBytes;
//Save the presentation
presentation.Save("PictureFill.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)
'Add a shape to the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 12, 23, 100, 220)
'Retrieve fill from the shape
Dim fill As IFill = shape.Fill
'Set the picture fill type to shape
fill.FillType = FillType.Picture
'Create an instance to hold the picture fill properties
Dim pictureFill As IPictureFill = fill.PictureFill
'Create a file stream and copy it to the memory stream
Dim pictureStream As FileStream = New FileStream("Image.png", FileMode.Open)
Dim memoryStream As MemoryStream = New MemoryStream()
pictureStream.CopyTo(memoryStream)
'Convert the memory stream into a byte array
Dim picBytes As Byte() = memoryStream.ToArray()
'Set Image Bytes
pictureFill.ImageBytes = picBytes
'Save the presentation
presentation__1.Save("PictureFill.pptx")
'Close the presentation
presentation__1.Close()
SolidFill
Gets an ISolidFill instance. Read-only.
Declaration
ISolidFill SolidFill { get; }
Property Value
Type | Description |
---|---|
ISolidFill | The solid fill. |
Examples
//Open a presentation.
IPresentation presentation = Presentation.Open("Template.pptx");
//Add a slide to the presentation.
ISlide slide = presentation.Slides.Add();
//Get the fill of slide background
IFill fill = slide.Background.Fill;
//Set the fill type
fill.FillType = FillType.Solid;
//Set the fill color
fill.SolidFill.Color = ColorObject.Red;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Open a presentation.
Dim presentation__1 As IPresentation = Presentation.Open("Template.pptx")
'Add a slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add()
'Get the fill of slide background
Dim fill As IFill = slide.Background.Fill
'Set the fill type
fill.FillType = FillType.Solid
'Set the fill color
fill.SolidFill.Color = ColorObject.Red
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()