Problems With Shapes

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));
}
 
J

JuneTheSecond

Are you glueing to pinX?
I thought you are glueing to the connection point.

If so, are their shapes simple ones with connection points?
If they are group of such shapes, dont forget the connection points are not
on the group shape, but on the child shapes.
 
P

Paul Herber

Hi,
To add to JuneTheSecond's response, you haven't set the shape's Y
coordinates.
My code works in all the other shapes that already have connectors points, but
it doesn't works with my connectors.

Also be aware that shapes and connectors don't have the same cells,
shapes are 2D but connectors are 1D. Hence, code that works with 2D
shapes may not work with 1D shapes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top