Shapes

Slides can contain various kinds of drawings. One special kind of drawing is a shape. A shape has some kind of geometry and can be filled and/or outlined. It also can contain text.

For more information about drawing types in GemBox.Presentation, see the GemBox.Presentation content model help page.

The following example shows how to create and customize shapes using the GemBox.Presentation API.

Screenshot of PowerPoint shapes created with GemBox.Presentation
PowerPoint shapes created with GemBox.Presentation
using GemBox.Presentation;

class Program
{
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var presentation = new PresentationDocument();

        // Create new slide; will create "custom" layout slide and default master slide.
        var slide = presentation.Slides.AddNew(SlideLayoutType.Custom);

        slide.Content.AddShape(ShapeGeometryType.RectangularCallout, 30, 30, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.AliceBlue));
        slide.Content.AddShape(ShapeGeometryType.RoundedRectangularCallout, 170, 30, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.BlueViolet));
        slide.Content.AddShape(ShapeGeometryType.OvalCallout, 310, 30, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.CadetBlue));
        slide.Content.AddShape(ShapeGeometryType.CloudCallout, 450, 30, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.CornflowerBlue));

        slide.Content.AddShape(ShapeGeometryType.ActionButtonEnd, 30, 150, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.DarkSeaGreen));
        slide.Content.AddShape(ShapeGeometryType.ActionButtonForwardOrNext, 170, 150, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.ForestGreen));
        slide.Content.AddShape(ShapeGeometryType.ActionButtonHelp, 310, 150, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.GreenYellow));
        slide.Content.AddShape(ShapeGeometryType.ActionButtonHome, 450, 150, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.LightSeaGreen));

        slide.Content.AddShape(ShapeGeometryType.UpArrow, 30, 270, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.DarkRed));
        slide.Content.AddShape(ShapeGeometryType.UpArrowCallout, 170, 270, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.IndianRed));
        slide.Content.AddShape(ShapeGeometryType.UpDownArrow, 310, 270, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.OrangeRed));
        slide.Content.AddShape(ShapeGeometryType.UpDownArrowCallout, 450, 270, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.MediumVioletRed));

        presentation.Save("Shapes.pptx");
    }
}
Imports GemBox.Presentation

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim presentation = New PresentationDocument

        ' Create New slide; will create "custom" layout slide And default master slide.
        Dim slide = presentation.Slides.AddNew(SlideLayoutType.Custom)

        slide.Content.AddShape(ShapeGeometryType.RectangularCallout, 30, 30, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.AliceBlue))
        slide.Content.AddShape(ShapeGeometryType.RoundedRectangularCallout, 170, 30, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.BlueViolet))
        slide.Content.AddShape(ShapeGeometryType.OvalCallout, 310, 30, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.CadetBlue))
        slide.Content.AddShape(ShapeGeometryType.CloudCallout, 450, 30, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.CornflowerBlue))

        slide.Content.AddShape(ShapeGeometryType.ActionButtonEnd, 30, 150, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.DarkSeaGreen))
        slide.Content.AddShape(ShapeGeometryType.ActionButtonForwardOrNext, 170, 150, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.ForestGreen))
        slide.Content.AddShape(ShapeGeometryType.ActionButtonHelp, 310, 150, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.GreenYellow))
        slide.Content.AddShape(ShapeGeometryType.ActionButtonHome, 450, 150, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.LightSeaGreen))

        slide.Content.AddShape(ShapeGeometryType.UpArrow, 30, 270, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.DarkRed))
        slide.Content.AddShape(ShapeGeometryType.UpArrowCallout, 170, 270, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.IndianRed))
        slide.Content.AddShape(ShapeGeometryType.UpDownArrow, 310, 270, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.OrangeRed))
        slide.Content.AddShape(ShapeGeometryType.UpDownArrowCallout, 450, 270, 130, 100, LengthUnit.Point).Format.Fill.SetSolid(Color.FromName(ColorName.MediumVioletRed))

        presentation.Save("Shapes.pptx")
    End Sub
End Module

Check next example or download examples from GitHub.