IndexOf

MathParagraph.IndexOf 方法

确定集合中特定 IMathBlock 的索引。

public int IndexOf(IMathBlock mathBlock)
参数类型描述
mathBlockIMathBlock要在集合中定位的项。

返回值

如果在集合中找到 mathBlock,则返回其索引;否则,返回 -1。

示例

示例:

[C#]
IAutoShape shape = slide.Shapes.AddMathShape(x, y, width, height);
IMathParagraph mathParagraph = (shape.TextFrame.Paragraphs[0].Portions[0] as MathPortion).MathParagraph;
IMathBlock block = new MathBlock(new MathematicalText("y"));
mathParagraph.Add(block);
int index = mathParagraph.IndexOf(block);

另请参见