/// <summary> /// Actually connect two shapes using Visio API /// </summary> /// <param name="shapeFrom">first shape</param> /// <param name="shapeTo">sec shape</param> /// <param name="shapeToWrap"></param> /// <param name="connectorMaster">shape wich connect shapes</param> /// <param name="fromPoint">point to connect on first shape</param> /// <param name="toPoint">point to connect on sec shape</param> /// <param name="shapeFromWrap"></param> protected void ConnectWithDynamicGlueAndConnector( ShapeWrapper shapeFromWrap, ShapeWrapper shapeToWrap, Master connectorMaster, VisCellIndices fromPoint, VisCellIndices toPoint, double x = 10, double y = 10) { Shape shapeFrom = shapeFromWrap.Shape; Shape shapeTo = shapeToWrap.Shape; Page visioPage = VisioApp.ActivePage; var connector = visioPage.Drop(connectorMaster, x, y); var beginXCell = connector.CellsSRC[(short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX]; beginXCell.GlueTo(shapeFrom.CellsSRC[(short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowAlign, (short)fromPoint]); var endXCell = connector.CellsSRC[(short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DEndX]; endXCell.GlueTo(shapeTo.CellsSRC[(short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowAlign, (short)toPoint]); }
private double GetSideLength(VisCellIndices cellIndex) { var cell = this.Page.PageSheet.GetCellSRC(VisSectionIndices.visSectionObject, VisRowIndices.visRowPage, cellIndex); double result = cell.Result[VisUnitCodes.visNumber]; return(result); }
/// <summary> /// Connect two shapes /// </summary> /// <param name="shapeFrom">first shape to connect</param> /// <param name="shapeTo">sec shape to connect</param> /// <param name="connectorMaster">shape wich connect shapes</param> /// <param name="connectionType">shape connection type</param> public void connectShapes(Shape shapeFrom, Shape shapeTo, ShapeForm shapeForm, ShapeConnectionType connectionType, double x = 4.25, double y = 10) { Master connectorMaster = getShapeMasterByShapeType(shapeForm); VisCellIndices conectionToType = VisCellIndices.visAlignTop; VisCellIndices conectionFromType = VisCellIndices.visAlignBottom; BuilderUtills.getCellsAlignsFromConnectionType(out conectionToType, out conectionFromType, connectionType); ConnectWithDynamicGlueAndConnector(shapeFrom, shapeTo, connectorMaster, conectionToType, conectionFromType, x, y); }
/// <summary> /// Out return cells aligment from given connection type /// </summary> /// <param name="conectionToType">Out cell aligment for connection to shape</param> /// <param name="conectionFromType">Out cell aligment for connection from shape</param> /// <param name="connectionType">type of shape connection</param> public static void getCellsAlignsFromConnectionType(out VisCellIndices conectionToType, out VisCellIndices conectionFromType, ShapeConnectionType connectionType) { conectionToType = VisCellIndices.visAlignTop; conectionFromType = VisCellIndices.visAlignBottom; switch (connectionType) { case ShapeConnectionType.FROM_LEFT_TO_TOP: conectionToType = VisCellIndices.visAlignTop; conectionFromType = VisCellIndices.visAlignLeft; break; case ShapeConnectionType.FROM_RIGHT_TO_TOP: conectionToType = VisCellIndices.visAlignTop; conectionFromType = VisCellIndices.visAlignRight; break; case ShapeConnectionType.FROM_BOT_TO_LEFT: conectionToType = VisCellIndices.visAlignLeft; conectionFromType = VisCellIndices.visAlignBottom; break; case ShapeConnectionType.FROM_TOP_TO_RIGHT: conectionToType = VisCellIndices.visAlignRight; conectionFromType = VisCellIndices.visAlignTop; break; case ShapeConnectionType.FROM_BOT_TO_CENTER: conectionToType = VisCellIndices.visAlignCenter; conectionFromType = VisCellIndices.visAlignBottom; break; case ShapeConnectionType.FROM_RIGHT_TO_CENTER: conectionToType = VisCellIndices.visAlignCenter; conectionFromType = VisCellIndices.visAlignRight; break; case ShapeConnectionType.FROM_RIGHT_TO_LEFT: conectionToType = VisCellIndices.visAlignLeft; conectionFromType = VisCellIndices.visAlignRight; break; case ShapeConnectionType.FROM_TOP_TO_BOT: conectionToType = VisCellIndices.visAlignBottom; conectionFromType = VisCellIndices.visAlignTop; break; case ShapeConnectionType.FROM_LEFT_TO_CENTER: conectionToType = VisCellIndices.visAlignCenter; conectionFromType = VisCellIndices.visAlignLeft; break; } }
/// <summary> /// Actually connect two shapes using Visio API /// </summary> /// <param name="shapeFrom">first shape</param> /// <param name="shapeTo">sec shape</param> /// <param name="connectorMaster">shape wich connect shapes</param> /// <param name="fromPoint">point to connect on first shape</param> /// <param name="toPoint">point to connect on sec shape</param> private void ConnectWithDynamicGlueAndConnector( Shape shapeFrom, Shape shapeTo, Master connectorMaster, VisCellIndices fromPoint, VisCellIndices toPoint, double x = 0, double y = 0) { Cell beginXCell; Cell endXCell; Shape connector; Page visioPage = visioApp.ActivePage; connector = visioPage.Drop(connectorMaster, x, y); beginXCell = connector.get_CellsSRC( (short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX); beginXCell.GlueTo(shapeFrom.get_CellsSRC( (short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowAlign, (short)fromPoint)); endXCell = connector.get_CellsSRC( (short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DEndX); endXCell.GlueTo(shapeTo.get_CellsSRC( (short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowAlign, (short)toPoint)); }
public static Cell GetCellSRC(this Shape shape, VisSectionIndices section, VisRowIndices row, VisCellIndices column) { return(shape.CellsSRC[(short)section, (short)row, (short)column]); }