AddGroupShape

AddGroupShape()

Erstellt eine neue GroupShape und fügt sie am Ende der Sammlung hinzu. Die Größe und Position des GroupShape-Rahmens werden an den Inhalt angepasst, wenn eine neue Form in das GroupShape hinzugefügt wird.

public IGroupShape AddGroupShape()

Rückgabewert

Erstelltes GroupShape-Objekt.

Beispiele

Das folgende Beispiel zeigt, wie man eine Gruppenform zu einer Folie der PowerPoint-Präsentation hinzufügt.

[C#]
// Präsentation-Klasse instanziieren
using (Presentation pres = new Presentation())
{
    // Die erste Folie abrufen
    ISlide sld = pres.Slides[0];
    // Zugriff auf die Formensammlung der Folien
    IShapeCollection slideShapes = sld.Shapes;
    // Eine Gruppenform zur Folie hinzufügen
    IGroupShape groupShape = slideShapes.AddGroupShape();
    // Formen innerhalb der hinzugefügten Gruppenform hinzufügen
    groupShape.Shapes.AddAutoShape(ShapeType.Rectangle, 300, 100, 100, 100);
    groupShape.Shapes.AddAutoShape(ShapeType.Rectangle, 500, 100, 100, 100);
    groupShape.Shapes.AddAutoShape(ShapeType.Rectangle, 300, 300, 100, 100);
    groupShape.Shapes.AddAutoShape(ShapeType.Rectangle, 500, 300, 100, 100);
    // Gruppenformrahmen hinzufügen
    groupShape.Frame = new ShapeFrame(100, 300, 500, 40, NullableBool.False, NullableBool.False, 0);
    // Die PPTX-Datei auf der Festplatte speichern
    pres.Save("GroupShape_out.pptx", SaveFormat.Pptx);
}

Siehe auch


AddGroupShape(ISvgImage, float, float, float, float)

Erstellt eine neue GroupShape, füllt sie mit konvertierten Formen aus SVG und fügt sie am Ende der Sammlung hinzu.

public IGroupShape AddGroupShape(ISvgImage svgImage, float x, float y, float width, float height)
ParameterTypBeschreibung
svgImageISvgImageSvg-Bildobjekt ISvgImage
xSingleDie X-Koordinate für die linke Seite des Gruppenformrahmens.
ySingleDie Y-Koordinate für die obere Seite des Gruppenformrahmens.
widthSingleDie Breite der Gruppe des Gruppenformrahmens.
heightSingleDie Höhe einer Gruppe des Gruppenformrahmens.

Rückgabewert

Erstelltes GroupShape-Objekt.

Siehe auch