I have two shapes, with connection points. I am using my own master for the two shapes, so I know the names of the connection points.
I'd like to make an arrow that connects one connection point (from) to another connection point in the second shape. Seems like a basic thing to do, but I can only find documentation or sample code for dynamic connectors, which don't let you choose the connection points. I downloaded and searched the Visio Code Samples Library, and I can't find anything on this.
In short, I'd like a function that does something like this:
//drop a connector onto the page, then connect them
public void dropStaticConnector(Shape sFrom, String connectionPointName1, Shape sTo, String connectionPointName2)
{
}
Can someone give sample code?
You could try something like the following:
//drop a connector onto the page, then connect them
public void dropStaticConnector(
Shape sFrom, String connectionPointName1,
Shape sTo, String connectionPointName2)
{
// drop a default connector
var conn = ActivePage.Drop(Application.ConnectorToolDataObject, 0, 0);
// glue it to the connection points
conn.Cells("BeginX").GlueTo(sFrom.Cells("Connections." + connectionPointName1));
conn.Cells("EndX").GlueTo(sTo.Cells("Connections." + connectionPointName2));
}
Means, you need to go the "old-fashioned" way. The new one is Shape.AutoConnect, but afaik it will not guarantee that the shapes will be glued to the connection point of your choice.
Here is the related article from DVS (Developing Viso Solutions) book - it still applies: http://msdn.microsoft.com/en-us/library/office/aa201778.aspx
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加