0

私はvisioでUMLダイアグラムをプログラムで描画しており、動的コネクタを使用して図形を接続しています。ソースと宛先の間にある別の形状を介して)、コネクタがページのみを通過する必要があることを望みます.Plsはこれを可能にする方法を提案します.

4

1 に答える 1

1

C# から翻訳する必要がありますが、これが私が行っている方法です。

/// <summary>Attaches two Visio shapes to each other with the specified connector object.</summary>
/// <param name="shape1">Visio shape to connect from.</param>
/// <param name="shape2">Visio shape to connect to.</param>
/// <param name="connector">Visio line shape that will connect shape1 to shape2.</param>
/// <param name="straight">Whether this connector should be a straight line</param>
[CLSCompliant(false)]
protected static void ConnectShapes(
    Visio.Shape shape1,
    Visio.Shape shape2,
    Visio.Shape connector,
    bool straight = false)
    {
        try
        {
            // get the cell from the source side of the connector
            Visio.Cell beginXCell = connector.CellsSRC[(short)Visio.VisSectionIndices.visSectionObject, (short)Visio.VisRowIndices.visRowXForm1D, (short)Visio.VisCellIndices.vis1DBeginX];

            // glue the source side of the connector to the first shape
            beginXCell.GlueTo(shape1.CellsSRC[(short)Visio.VisSectionIndices.visSectionObject, (short)Visio.VisRowIndices.visRowXFormOut, (short)Visio.VisCellIndices.visXFormPinX]);

            // get the cell from the destination side of the connector
            Visio.Cell endXCell = connector.CellsSRC[(short)Visio.VisSectionIndices.visSectionObject, (short)Visio.VisRowIndices.visRowXForm1D, (short)Visio.VisCellIndices.vis1DEndX];

            // glue the destination side of the connector to the second shape
            endXCell.GlueTo(shape2.CellsSRC[(short)Visio.VisSectionIndices.visSectionObject, (short)Visio.VisRowIndices.visRowXFormOut, (short)Visio.VisCellIndices.visXFormPinX]);

            if (straight)
            {
                connector.CellsU["ConLineRouteExt"].ResultIUForce = (double)Visio.VisCellVals.visLORouteExtStraight;
                connector.CellsU["ShapeRouteStyle"].ResultIUForce = (double)Visio.VisCellVals.visLORouteCenterToCenter;
            }
            else
            {
                // THIS IS WHAT YOU ARE LOOKING FOR
                connector.CellsU["ConLineRouteExt"].ResultIUForce = (double)Visio.VisCellVals.visLORouteExtNURBS;
                connector.CellsU["ShapeRouteStyle"].ResultIUForce = (double)Visio.VisCellVals.visLORouteRightAngle;
            }
        }
        catch (Exception e)
        {
            throw (e);
        }
    }
于 2013-05-10T17:06:42.600 に答える