Class Shape
Inheritance
System.Object
Shape
Assembly: IronPPT.dll
Syntax
public class Shape : BaseGraphicContainer, ICloneableElement, IParentElement, IShape, IGraphic, IContentElement
Drawing a shape onto a slide, an arrow, rectangle, or circle that structures content or draws the eye, runs through Shape. It models a single graphic placed on a slide, with its own type, colors, and identity, so a developer can build diagrams and callouts directly from code.
A developer creates one with new Shape() and adds it to a slide through Slide.AddShape, which accepts the shape and returns an IShape. The Type property, a Nullable<ShapeType>, picks the geometry from the ShapeType enum (a triangle, rectangle, or one of the other preset forms). FillColor and OutlineColor are IColor values that set the interior and the border. Name gives the shape a readable label and Id (a uint) is its identifier within the slide. The Clone method returns a copy as an IContentElement, handy for repeating a styled shape across slides.
Set Type first so the shape has a geometry, then assign FillColor and OutlineColor for its look; size and position come from the inherited graphic members. The ShapeType enum covers the common preset forms, so picking a member is how a developer chooses between an arrow, a rectangle, an oval, and the rest without drawing geometry by hand. Because Shape is a content element, the same instance can be added, cloned, and re-styled without rebuilding it from scratch, which keeps diagram-generation code compact. When a slide needs several similar shapes, build one, set its type and colors, and use Clone to stamp out the variants rather than repeating the setup.
var shape = new Shape();
shape.Type = ShapeType.Triangle;
shape.OutlineColor = outlineColor;
slide.AddShape(shape);
The add shape example builds and colors a shape, the add slide how-to creates slides to place them on, and the manage slide how-to arranges the slides that hold them.
Constructors
Shape()
Declaration
Properties
FillColor
Declaration
public IColor FillColor { get; set; }
Property Value
Id
Declaration
public uint Id { get; set; }
Property Value
| Type |
Description |
| System.UInt32 |
|
Name
Declaration
public string Name { get; set; }
Property Value
| Type |
Description |
| System.String |
|
OutlineColor
Declaration
public IColor OutlineColor { get; set; }
Property Value
Type
Declaration
public Nullable<ShapeType> Type { get; set; }
Property Value
Methods
Clone()
Declaration
public override IContentElement Clone()
Returns
Overrides
Implements