Add Connection Point To Shape

Add Connection Point To a Shape in Visio

This topic elaborates how developers can add connection point to a visio shape using Aspose.Diagram for .NET.

Add Connection Point

The Connections object represents the connection collection in the Shape class.

The code below shows how to:

  1. Load a sample diagram.
  2. get a particular page.
  3. get a particular shape.
  4. new a connection
  5. set the property of connection
  6. add connection to shape
  7. save diagram

Add connection point to shape Programming Sample

Use the following code in your .NET application to add connection to a shape using Aspose.Diagram for .NET.

// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Shapes();
// Call a Diagram class constructor to load the VSD diagram
Diagram diagram = new Diagram(dataDir + "Drawing1.vsd");
// Get a particular page
Page page = diagram.Pages.GetPage("Page-3");
// Get a dynamic connector type shape by id
Shape shape = page.Shapes.GetShape(18);
// Set dynamic connector appearance
shape.SetConnectorsType(ConnectorsTypeValue.StraightLines);
// Saving Visio diagram
diagram.Save(dataDir + "SetConnectorAppearance_out.vsdx", SaveFileFormat.VSDX);