Trabajar con la sección de geometría
Contents
[
Hide
]
Editar la sección de geometría del conector en ShapeSheet
Cualquier forma en Microsoft Office Visio se compone de una o más “geometrías”. Cada geometría representa un componente diferente de la forma. La mayoría de las formas tienen solo una geometría, pero algunas tienen dos o más. Aspose.Diagram Las API permiten a los desarrolladores administrar estas geometrías mediante programación.
Ejemplo de programación
Los fragmentos de código a continuación administran las geometrías de una forma.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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_GeometrySection(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Set connector shape by page name and ID | |
long connectorId = 4; | |
Shape connector = diagram.Pages.GetPage("Page-1").Shapes.GetShape(connectorId); | |
// Get connector geometry at index 0 | |
LineTo defaultLineTo = connector.Geoms[0].CoordinateCol.LineToCol[0]; | |
// Remove connector geometry from index 0 | |
connector.Geoms[0].CoordinateCol.LineToCol[0].Del = BOOL.True; | |
// Initialize LineTo geometry object | |
LineTo lineTo = new LineTo(); | |
// Set X value | |
lineTo.X.Value = 0; | |
// Set Y value | |
lineTo.Y.Value = defaultLineTo.Y.Value / 2; | |
// Add connector geometry | |
connector.Geoms[0].CoordinateCol.Add(lineTo); | |
// Initialize LineTo geometry object | |
lineTo = new LineTo(); | |
// Set Y value | |
lineTo.Y.Value = defaultLineTo.Y.Value / 2; | |
// Set X value | |
lineTo.X.Value = defaultLineTo.X.Value; | |
// Add connector geometry | |
connector.Geoms[0].CoordinateCol.Add(lineTo); | |
// Initialize LineTo geometry object | |
lineTo = new LineTo(); | |
// Set X value | |
lineTo.X.Value = defaultLineTo.X.Value; | |
// Set Y value | |
lineTo.Y.Value = defaultLineTo.Y.Value; | |
// Add connector geometry | |
connector.Geoms[0].CoordinateCol.Add(lineTo); | |
// Save diagram in VDX format | |
diagram.Save(dataDir + "EditConnectorGeometry_out.vsdx", SaveFileFormat.VSDX); |