GetRect

Portion.GetRect method

获取边界部分的矩形坐标。 rect 包括部分 文本的所有行,包括空行。

public RectangleF GetRect()

例子

示例:

[C#]
using (Presentation pres = new Presentation())

   ISlide slide = pres.Slides[0];
   IAutoShape shape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 200, 50);

   shape.TextFrame.Paragraphs[0].Portions.Clear();
   var portion0 = new Portion("Some text");
   var portion1 = new Portion("GetRect text");

   shape.TextFrame.Paragraphs[0].Portions.Add(portion0);
   shape.TextFrame.Paragraphs[0].Portions.Add(portion1);

   RectangleF rect = shape.TextFrame.Paragraphs[0].Portions[1].GetRect();
   ...

也可以看看