在C#中检索Visio形状的连接点名称

我正在使用Microsoft Visio 2007和Visual C#.
我有一些形状的模具.模具中每个主形状的每个连接点都有一个名称.如何在C#中获得这些名称?

我需要一种区分形状的连接点的方法,并且我认为为每个连接点分配名称是最简单的方法.

附言
我在主形状的所谓“ ShapeSheet”中为连接点分配了名称,即在同一位置可以看到连接点的坐标.

解决方法:

下面的示例使用Cell Indices遍历“连接点”行中的所有X单元. RowName属性用于获取该部分中每一行的名称.

Visio.Shape shape = // get the shape

List<string> listOfNames = new List<string>();

// Loop through all the connection point rows in the shape.
short iRow = (short) Visio.VisRowIndices.visRowConnectionPts;
while (shape.get_RowExists(
    (short) Visio.VisSectionIndices.visSectionConnectionPts, 
    iRow, 
    (short) 0) != 0)
{
    // Get a cell from the connection point row.
    Visio.Cell cell = shape.get_CellsSRC(
        (short) Visio.VisSectionIndices.visSectionConnectionPts,
        iRow,
        (short) Visio.VisCellIndices.visCnnctX);

    // Ask the cell what row it is in.
    listOfNames.Add(cell.RowName);

    // Next row.
    ++iRow;
}
上一篇:使用Visio生成MySQL DDL


下一篇:从现有的MySQL数据库生成Visio ERD