Changing default text position for connectors

Hi

I would like the connector text appear a little above ( SHOW HERE ) ; compared to the default position (FastEherenet /021 ). Please refer the attachment

Shall it be possible. Please let me know


Thanks
Sujay

Hi Sujay,

Can you please share your input document, code and your expected output?

Best Regards,

1 Like

Hi

Please refer to the picture

The text “FastEthernet” should be displayed where “SHOW HERE” text is being displayed .


Hi Sujay,


Thank you for the inquiry. Is there some empty lines between both text strings? How are you generating this output Visio diagram? It would be great if you can please provide us source diagram, source code and resultant diagram. It will help us to be more specific. By this, we can investigate it on our side.

We’re looking forward to help you.

Hi

Here is the code

Shape conSrcToVlan = new Shape();
string connectorMaster = “Dynamic connector”;
conSrcToVlan.Text.Value.Add(new Txt(“FastEthernet0/21”));
long srcVlanId = topologyDiagram.AddShape(conSrcToVlan, connectorMaster);
topologyDiagram.Connect(sourceDeviceId, ConnectionPointPlace.Right, vlanShapeId, ConnectionPointPlace.Left, srcVlanId);

The Connect method is as below


public void Connect(long shapeFrom, ConnectionPointPlace placeFrom, long shapeTo, ConnectionPointPlace placeTo, long connectorId)
{
_diagram.Pages[0].ConnectShapesViaConnector(shapeFrom, placeFrom, shapeTo, placeTo, connectorId);
}

Hi Sujay,


Thank you for sharing this source code. When we tested your scenario against our sample Visio diagram, it looks slightly different. Please provide your problematic source Visio diagram in this forum thread. It’ll help to be more specific and provide you an exact fix which you are expecting from us.

Hi Imran ,

Please refer the picture in first post in this thread .

I would like to display FastEthernet /021 at the place “SHOW HERE” has been displayed

Thanks
Sujay

Hi Sujay,


Thank you for the inquiry. Please note, there is a “Controls” tab under each shape sheet. Its X and Y properties allow to adjust shape’s text position. We’ve attached a screenshot (Screenshot.png) to this reply for your kind reference. You can set these properties by using Aspose.Diagram APIs as follows:

[.NET, C#]
// get connector shape by its id
Shape connector = diagram.Pages[0].Shapes.GetShape(srcVlanId);
// set its horizontal position
connector.Controls[0].X.Value = 0.9375;
// set its vertical position
connector.Controls[0].Y.Value = 0.125;

We hope, this helps. Please let us know in case of any confusion or questions.

Hi ,

Please explain me “Controls tab under each Shape Sheet” .

I am not familiar with the screenshot, are you using ActiveX control . Can I use them in Winforms ( design mode )

Thanks
Sujay

Hi Sujay,

Thank you for the inquiry. Please note, each shape in Microsoft Office Visio has a ShapeSheet (spreadsheet) that stores information about it. When you will open the drawing in the Microsoft Office Visio, please right-click the connector shape in the drawing and click “Show ShapeSheet”. You will see a shape sheet at the bottom of the drawing. You can check other details in the following help topic: [Open the ShapeSheet for a Shape, Page, or Document ]

Please let us know in case of any further assistance.