H
ha1o
Hi
I started to work with a master to represent a hub in a drawing. then I
found out that this shape doesn't have connectors. So I insert a new section
named Connection Points. When I create a new draw manually, I am able to
connect this Hub to a Dynamic Connector. but I cannot do that by code. My
code works in all the other shapes that already have connectors points, but
it doesn't works with my connectors.
thaks for your help
The instruction I'm using is this:
public void ConnectWithDynamicGlueAndConnector(
Microsoft.Office.Interop.Visio.Shape shapeFrom,
Microsoft.Office.Interop.Visio.Shape shapeTo)
{ Microsoft.Office.Interop.Visio.Maste masterInStencil =
stencil.Masters.get_ItemU(
DYNAMIC_CONNECTOR_MASTER);
// Drop the dynamic connector on the active page.
Microsoft.Office.Interop.Visio.Shape connector =
visioApplication.ActivePage.Drop(
masterInStencil, 0, 0);
// Connect the begin point of the dynamic connector to the
// PinX cell of the first 2-D shape.
Microsoft.Office.Interop.Visio.Cell beginX = connector.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXForm1D,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.vis1DBeginX);
beginX.GlueTo(shapeFrom.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXFormOut,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.visXFormPinX));
// Connect the end point of the dynamic connector to the
// PinX cell of the second 2-D shape.
Microsoft.Office.Interop.Visio.Cell endX = connector.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXForm1D,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.vis1DEndX);
endX.GlueTo(shapeTo.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXFormOut,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.visXFormPinX));
}
I started to work with a master to represent a hub in a drawing. then I
found out that this shape doesn't have connectors. So I insert a new section
named Connection Points. When I create a new draw manually, I am able to
connect this Hub to a Dynamic Connector. but I cannot do that by code. My
code works in all the other shapes that already have connectors points, but
it doesn't works with my connectors.
thaks for your help
The instruction I'm using is this:
public void ConnectWithDynamicGlueAndConnector(
Microsoft.Office.Interop.Visio.Shape shapeFrom,
Microsoft.Office.Interop.Visio.Shape shapeTo)
{ Microsoft.Office.Interop.Visio.Maste masterInStencil =
stencil.Masters.get_ItemU(
DYNAMIC_CONNECTOR_MASTER);
// Drop the dynamic connector on the active page.
Microsoft.Office.Interop.Visio.Shape connector =
visioApplication.ActivePage.Drop(
masterInStencil, 0, 0);
// Connect the begin point of the dynamic connector to the
// PinX cell of the first 2-D shape.
Microsoft.Office.Interop.Visio.Cell beginX = connector.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXForm1D,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.vis1DBeginX);
beginX.GlueTo(shapeFrom.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXFormOut,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.visXFormPinX));
// Connect the end point of the dynamic connector to the
// PinX cell of the second 2-D shape.
Microsoft.Office.Interop.Visio.Cell endX = connector.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXForm1D,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.vis1DEndX);
endX.GlueTo(shapeTo.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXFormOut,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.visXFormPinX));
}