Drawing Classes — Aspose.Slides FOSS for .NET API Reference
This page covers drawing-related classes used for shapes, pictures, and connectors in Aspose.Slides FOSS for .NET.
Package: Aspose.Slides.Foss (net9.0)
using Aspose.Slides.Foss;AutoShape
An auto shape is a geometry shape that can hold text. It extends GeometryShape.
public class AutoShape : GeometryShape, IAutoShapeProperties
| Property | Type | Access | Description |
|---|---|---|---|
ShapeType | ShapeType | Read | Geometry type (Rectangle, Ellipse, etc.). |
TextFrame | ITextFrame? | Read | Text content of the shape. |
IsTextBox | bool | Read | Whether the shape was created as a text box. |
Methods
| Method | Description |
|---|---|
AddTextFrame(string? text) | Add a text frame with the specified text. |
PictureFrame
A shape that displays an embedded image.
public class PictureFrame : GeometryShape, IPictureFrameProperties
| Property | Type | Access | Description |
|---|---|---|---|
ShapeType | ShapeType | Read | Shape geometry type. |
PictureFrameLock | IPictureFrameLock? | Read | Lock settings for the picture frame. |
PictureFormat | IPictureFillFormat? | Read | Picture fill settings (crop, tile, etc.). |
RelativeScaleHeight | float | Read | Relative height scale. |
RelativeScaleWidth | float | Read | Relative width scale. |
IsCameo | bool | Read | Whether this is a cameo (profile picture) frame. |
PictureFillFormat
Controls how an image fills a shape or background.
public class PictureFillFormat : PVIObject, IPictureFillFormatProperties
| Property | Type | Access | Description |
|---|---|---|---|
Dpi | int | Read | Image DPI. |
PictureFillMode | PictureFillMode | Read | Fill mode (Stretch, Tile). |
Picture | ISlidesPicture | Read | The embedded picture. |
CropLeft | float | Read | Left crop percentage. |
CropTop | float | Read | Top crop percentage. |
CropRight | float | Read | Right crop percentage. |
CropBottom | float | Read | Bottom crop percentage. |
TileOffsetX | float | Read | Tile X offset. |
TileOffsetY | float | Read | Tile Y offset. |
TileScaleX | float | Read | Tile X scale. |
TileScaleY | float | Read | Tile Y scale. |
TileAlignment | RectangleAlignment | Read | Tile alignment. |
TileFlip | TileFlip | Read | Tile flip mode. |
Connector
A connector shape that links two shapes.
public class Connector : GeometryShape, IConnectorProperties
| Property | Type | Access | Description |
|---|---|---|---|
StartShapeConnectedTo | IShape? | Read | Shape at the start of the connector. |
EndShapeConnectedTo | IShape? | Read | Shape at the end of the connector. |
StartShapeConnectionSiteIndex | int | Read | Connection site index on the start shape. |
EndShapeConnectionSiteIndex | int | Read | Connection site index on the end shape. |
ConnectorLock | IConnectorLock? | Read | Lock settings. |
Methods
| Method | Description |
|---|---|
Reroute() | Recalculate the connector path. |
GeometryShape
Base class for shapes with geometry (auto shapes, connectors, picture frames).
public class GeometryShape : Shape, IGeometryShapeProperties
| Property | Type | Access | Description |
|---|---|---|---|
ShapeStyle | IShapeStyle? | Read | Theme style applied to the shape. |
ShapeType | ShapeType | Read | Geometry preset type. |
Adjustments | IAdjustValueCollection? | Read | Geometry adjustment values. |
Usage Examples
Add a Picture Frame
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation();
using var imgStream = File.OpenRead("photo.png");
var image = prs.Images.AddImage(imgStream);
var picFrame = prs.Slides[0].Shapes.AddPictureFrame(
ShapeType.Rectangle, 50, 50, 300, 200, image);
prs.Save("picture.pptx", SaveFormat.Pptx);Add a Connector
using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;
using var prs = new Presentation();
var slide = prs.Slides[0];
var shapeA = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 100, 60);
var shapeB = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 300, 50, 100, 60);
var connector = slide.Shapes.AddConnector(ShapeType.BentConnector3, 150, 80, 150, 80);
prs.Save("connector.pptx", SaveFormat.Pptx);