AddMathShape

ShapeCollection.AddMathShape-Methode

Erstellt eine neue Autoshape, die von der Standardvorlage für mathematische Inhalte angepasst wurde, und fügt sie am Ende der Sammlung hinzu.

public IAutoShape AddMathShape(float x, float y, float width, float height)
ParameterTypBeschreibung
xEinzelner WertDie X-Koordinate für die linke Seite des Rahmens der Form.
yEinzelner WertDie Y-Koordinate für die obere Seite des Rahmens der Form.
widthEinzelner WertDie Breite des Rahmens der Form.
heightEinzelner WertDie Höhe des Rahmens der Form.

Rückgabewert

Erstelltes AutoShape-Objekt.

Beispiele

Das folgende Beispiel zeigt, wie man eine mathematische Gleichung in einer PowerPoint-Präsentation hinzufügt.

[C#]
using (Presentation pres = new Presentation())
{
   IAutoShape mathShape = pres.Slides[0].Shapes.AddMathShape(0, 0, 720, 150);
   var mathParagraph = (mathShape.TextFrame.Paragraphs[0].Portions[0] as MathPortion).MathParagraph;
   var fraction = new MathematicalText("x").Divide("y");
   mathParagraph.Add(new MathBlock(fraction));
   var mathBlock = new MathematicalText("c")
        .SetSuperscript("2")
        .Join("=")
        .Join(new MathematicalText("a").SetSuperscript("2"))
        .Join("+")
        .Join(new MathematicalText("b").SetSuperscript("2"));
    mathParagraph.Add(mathBlock);
    pres.Save("math.pptx", SaveFormat.Pptx);
}

Siehe auch