GemBox.Presentation
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    FillFormat Class

    Namespace:
    GemBox.Presentation
    Assembly:
    GemBox.Presentation.dll

    Represents a base class for fills such as solid, gradient, picture, pattern, etc. that can be applied to various objects, such as shapes, text characters, table cells and their outlines, borders and underlines.

    • C#
    • VB.NET
    public abstract class FillFormat
    Public MustInherit Class FillFormat
    Inheritance:
    System.Object
    FillFormat
    Derived
    GradientFillFormat
    PatternFillFormat
    PictureFillFormat
    SolidFillFormat

    Properties

    FillType

    Gets the type of the fill.

    • C#
    • VB.NET
    public abstract FillFormatType FillType { get; }
    Public MustOverride ReadOnly Property FillType As FillFormatType
    Property Value
    FillFormatType

    The type of the fill.

    Methods

    SetGradient(GradientFillType)

    Sets the fill to the gradient fill.

    • C#
    • VB.NET
    public GradientFillFormat SetGradient(GradientFillType gradientFillType)
    Public Function SetGradient(gradientFillType As GradientFillType) As GradientFillFormat
    Parameters
    gradientFillType
    GradientFillType

    The type of the gradient.

    Returns
    GradientFillFormat

    An instance of a GradientFillFormat type that was set and can be used to set the type and stops of the gradient fill.

    SetNone()

    Sets the fill to none, thus making the area transparent.

    • C#
    • VB.NET
    public FillFormat SetNone()
    Public Function SetNone As FillFormat
    Returns
    FillFormat

    An instance of a FillFormat type that represents no fill that was set.

    SetPattern(PatternFillType, Color, Color)

    Sets the fill to the pattern fill.

    • C#
    • VB.NET
    public PatternFillFormat SetPattern(PatternFillType patternType, Color foregroundColor, Color backgroundColor)
    Public Function SetPattern(patternType As PatternFillType, foregroundColor As Color, backgroundColor As Color) As PatternFillFormat
    Parameters
    patternType
    PatternFillType

    Type of the pattern fill.

    foregroundColor
    Color

    Foreground color of the pattern fill.

    backgroundColor
    Color

    Background color of the pattern fill.

    Returns
    PatternFillFormat

    An instance of a PatternFillFormat type that was set.

    SetPicture(Content)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    • C#
    • VB.NET
    public PictureFillFormat SetPicture(Content content)
    Public Function SetPicture(content As Content) As PictureFillFormat
    Parameters
    content
    Content

    Content of the picture data.

    Returns
    PictureFillFormat

    An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.

    Remarks

    Use this overload if multiple PictureFillFormats should share the same picture data.

    Exceptions
    System.ArgumentNullException

    content is null.

    SetPicture(Stream)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    • C#
    • VB.NET
    public PictureFillFormat SetPicture(Stream stream)
    Public Function SetPicture(stream As Stream) As PictureFillFormat
    Parameters
    stream
    System.IO.Stream

    Stream containing the picture data.

    Returns
    PictureFillFormat

    An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.

    Remarks

    Use this overload to automatically detect the picture content type from the decoded picture stream.

    Exceptions
    System.ArgumentNullException

    stream is null.

    System.ArgumentException

    Picture stream encoding format is not supported.

    SetPicture(Stream, PictureContentType)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    • C#
    • VB.NET
    public PictureFillFormat SetPicture(Stream stream, PictureContentType contentType)
    Public Function SetPicture(stream As Stream, contentType As PictureContentType) As PictureFillFormat
    Parameters
    stream
    System.IO.Stream

    Stream containing the picture data.

    contentType
    PictureContentType

    Content type of the picture data.

    Returns
    PictureFillFormat

    An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.

    Remarks

    Use this overload to explicitly specify picture content type so that the picture stream doesn't have to be decoded to detect the picture content type.

    Exceptions
    System.ArgumentNullException

    stream is null.

    SetPicture(Stream, String)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    • C#
    • VB.NET
    public PictureFillFormat SetPicture(Stream stream, string contentType)
    Public Function SetPicture(stream As Stream, contentType As String) As PictureFillFormat
    Parameters
    stream
    System.IO.Stream

    Stream containing the picture data.

    contentType
    System.String

    Content type (MIME type) of the picture data.

    Returns
    PictureFillFormat

    An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.

    Remarks

    Use this overload to explicitly specify picture content type that is not supported by the PictureContentType.

    Exceptions
    System.ArgumentNullException

    stream is null.

    System.ArgumentException

    contentType is null or System.String.Empty.

    SetPicture(String, PictureContentType)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    • C#
    • VB.NET
    public PictureFillFormat SetPicture(string picturePath, PictureContentType contentType)
    Public Function SetPicture(picturePath As String, contentType As PictureContentType) As PictureFillFormat
    Parameters
    picturePath
    System.String

    Path to a picture data.

    contentType
    PictureContentType

    Content type of the picture data.

    Returns
    PictureFillFormat

    An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.

    Remarks

    Use this overload to explicitly specify picture content type (for example, if picturePath doesn't specify a file extension).

    Exceptions
    System.ArgumentException

    picturePath is null or System.String.Empty.

    SetPicture(String, Boolean)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    • C#
    • VB.NET
    public PictureFillFormat SetPicture(string picturePath, bool isLink = false)
    Public Function SetPicture(picturePath As String, isLink As Boolean = False) As PictureFillFormat
    Parameters
    picturePath
    System.String

    Path or link to a picture data.

    isLink
    System.Boolean

    true if the picture is linked to the file in which PresentationDocument instance is saved; otherwise, false.

    Returns
    PictureFillFormat

    An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.

    Remarks

    Use this overload to automatically detect the picture content type from the picturePath extension.

    Parameter picturePath must contain supported extension (for example, ".png") if isLink is false, otherwise exception is thrown.

    Exceptions
    System.ArgumentException

    picturePath is null or System.String.Empty or picturePath doesn't contain extension or extension is not supported.

    SetPicture(String, String)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    • C#
    • VB.NET
    public PictureFillFormat SetPicture(string picturePath, string contentType)
    Public Function SetPicture(picturePath As String, contentType As String) As PictureFillFormat
    Parameters
    picturePath
    System.String

    Path to a picture data.

    contentType
    System.String

    Content type (MIME type) of the picture data.

    Returns
    PictureFillFormat

    An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.

    Remarks

    Use this overload to explicitly specify picture content type that is not supported by the PictureContentType.

    Exceptions
    System.ArgumentException

    picturePath or contentType is null or System.String.Empty.

    SetSlideBackground()

    Sets the fill of the Shape to that of the slide background surface. Applicable only on Shape's fill.

    This method does not set the fill of the shape to be transparent but instead sets it to be filled with the portion of the slide background that is directly behind it.

    • C#
    • VB.NET
    public FillFormat SetSlideBackground()
    Public Function SetSlideBackground As FillFormat
    Returns
    FillFormat

    An instance of a FillFormat type that represents slide background fill that was set.

    Exceptions
    System.InvalidOperationException

    Setting the fill to the slide's background is only supported on Shape's fill.

    SetSolid(Color)

    Sets the fill to the solid fill.

    • C#
    • VB.NET
    public SolidFillFormat SetSolid(Color color)
    Public Function SetSolid(color As Color) As SolidFillFormat
    Parameters
    color
    Color

    The color of the solid fill.

    Returns
    SolidFillFormat

    An instance of a SolidFillFormat type that was set.

    Examples

    Shape Formatting Example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.