Interface IShape
Assembly: IronPPT.dll
Syntax
public interface IShape : IGraphic, IContentElement
IShape is the contract you work through whenever code touches a shape on a slide, whether that shape is a rectangle, a picture frame, or a text box. It gives a uniform way to read and adjust a shape's appearance and placement without caring which concrete kind of shape it actually is, so a loop over a slide's shapes can recolor, rename, or reposition each one through the same members.
The concrete implementors in IronPPT are Shape and TextBox (a TextBox is a Shape that also holds text). A developer rarely names the interface directly: shapes arrive already typed through ISlide.Shapes, which is a List<IShape>, or are added with AddShape. Working against IShape rather than a concrete class keeps shape-editing code generic across those kinds and easy to test with a stub.
The everyday members are FillColor and OutlineColor (both typed as IColor) for appearance, Name and Type for identity, and the geometry methods Resize, Rotate, FlipHorizontal, and FlipVertical. Type is a Nullable<ShapeType> describing what the shape is, Index reports its place in the slide's shape list, and Id and Clone round out the surface. Position and size members such as Height, Width, Angle, and Position are inherited from IGraphic, so a single shape exposes both its own appearance surface and the graphic geometry every slide element shares. Because the same members exist on every implementor, code that recolors or repositions one shape works unchanged across rectangles, pictures, and text boxes, which is what makes batch edits over ISlide.Shapes practical.
foreach (IShape shape in slide.Shapes)
{
shape.Name = "Logo";
shape.Rotate(90);
}
The add shape example adds a shape to a slide, the slide element tutorial walks through positioning elements on a slide, and the manage slide how-to covers working with a slide's contents.
Properties
FillColor
Declaration
IColor FillColor { get; set; }
Property Value
Id
Declaration
Property Value
| Type |
Description |
| System.UInt32 |
|
Index
Declaration
Property Value
| Type |
Description |
| System.Int32 |
|
Name
Declaration
string Name { get; set; }
Property Value
| Type |
Description |
| System.String |
|
OutlineColor
Declaration
IColor OutlineColor { get; set; }
Property Value
Type
Declaration
Nullable<ShapeType> Type { get; set; }
Property Value
Methods
Clone()
Declaration
Returns
FlipHorizontal()
Declaration
FlipVertical()
Declaration
Resize(Int32, Int32)
Declaration
void Resize(int width, int height)
Parameters
| Type |
Name |
Description |
| System.Int32 |
width |
|
| System.Int32 |
height |
|
Rotate(Double)
Declaration
void Rotate(double angle)
Parameters
| Type |
Name |
Description |
| System.Double |
angle |
|