我正在使用Microsoft Visio2007和Visual C#。我有一个带有一些形状的钢网。模具中每个主控形状的每个连接点都有一个名称。如何在C#中获取这些名称?
我需要一种方法来区分形状的连接点,我认为为每个连接点指定一个名称是最简单的方法。
附注:我给主控形状的所谓"ShapeSheet“中的连接点指定了名称,即可以看到连接点坐标的同一位置。
发布于 2011-07-21 12:30:58
下面的示例使用Cell Indices遍历Connection Point行中的所有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;
}发布于 2011-07-14 11:10:27
给定一个Shape对象,您可以使用Cells属性获取连接点行的X Cell。如果您使用的是PIA,则可以像这样进行呼叫:
Visio.Shape shape ; // get the shape
Visio.Cell cell = shape.get_Cells("Connections.MyName.X"); 从这个Cell对象中,您可以访问连接点Row的其余部分。
如果您使用的是不同本地化版本的CellsU,或者您计划本地化应用程序,则应该调查Visio和Visio之间的差异。
https://stackoverflow.com/questions/6676636
复制相似问题