We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Changing Text in node added from palette

Thread ID:

Created:

Updated:

Platform:

Replies:

81929 May 24,2009 10:52 PM May 28,2009 05:49 AM Windows Forms 5
loading
Tags: Diagram
Steven Mohnkern
Asked On May 24, 2009 10:52 PM

Hello,

I am new to Syncfusion and have a couple of basic questions about Essential Diagram.

1) If I add a node from the palette, is it possible to later double click the node and change the text?
2) I am adding connections using ActivateTool but need to capture the event so I can add a label to the connection. Is this possible?

Thanks,
Steve

Gowri Manohari D [Syncfusion]
Replied On May 25, 2009 06:23 AM


Hi Steve,


Thanks for choosing Syncfusion Products.

We can change the text of the node on Node Double Click.The below is the code snippet for changing the node text in Node Double Click event.

For your second requirement After draw the Line using Activate Tool,double click the line and add the label to the Line.The below code illstrate this.

we can add the label to the Connection via Node Double Click event.

In Node Double Click event we have to check what type of Node has double clicked now.If it is a Connector means add label to the Connector.If it is a symbol or shape means change the label for the particular node.

Please refer the below code for more details,


Private Sub Diagram1_NodeDoubleClick(ByVal e As NodeMouseEventArgs)

Dim s As String
'Getting input from the user
s = InputBox("Enter the node label text here", "Node Label")
If (TypeOf (e.Node) Is Syncfusion.Windows.Forms.Diagram.Line) Then
'Adding label to the connetcor
Dim l As Syncfusion.Windows.Forms.Diagram.Label = New Syncfusion.Windows.Forms.Diagram.Label()

l.Position = Position.Center
l.FontStyle.Family = "Arial"
l.FontStyle.Size = 9
l.FontColorStyle.Color = Color.MidnightBlue
l.FontStyle.Bold = True
l.Text = s
Dim con As Syncfusion.Windows.Forms.Diagram.Line = e.Node
con.Labels.Add(l)
Else
Dim node As FilledPath = e.Node
node.Labels(0).Text = s 'Changing node label here

End If

End Sub

Thanks & Regards,
Gowri

Steven Mohnkern
Replied On May 25, 2009 10:52 AM

Thank you - that was just what I was looking for. Your support is excellent.

Steven Mohnkern
Replied On May 25, 2009 12:00 PM

When I create a LineConnector from right to left, the text is inverted and upside down. Is there a way to flip just the label?

Also, if I use custom position, everytime I move a node it seems that I will have to recalculate the proper location for the labels of all connectors attached to that node. Is there an automated way to do this? If I use Position.Center, the label is right on the line and I need it above the line.

Thanks again

Gowri Manohari D [Syncfusion]
Replied On May 26, 2009 09:06 AM

Hi SteveM,

We are working on this issue. We have to customize the label properties for positioning. It will take time for Customization. Already we have implemented UpdatePostion property for the label. We will provide the workaround for this in one business day.

Thanks & Regards,
Gowri

Gowri Manohari D [Syncfusion]
Replied On May 28, 2009 05:49 AM

Hi SteveM,

The below is the code snippet for your requirement.

Label has the UpdatePosition and Position property for positioning on the node.If we set the UpdatePosition property to true,the label to be fixed in the specified position.Position property indicates the location of the label in the node.More number of positions available we can change the position according to our need.Please refer the code for more details



LineConnector connector = new LineConnector(PointF.Empty, new PointF(0, 1));
connector.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;
connector.TailDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;
connector.LineStyle.LineColor = Color.MidnightBlue;
connector.HeadDecorator.FillStyle.Color = Color.MidnightBlue;
connector.TailDecorator.FillStyle.Color = Color.MidnightBlue;

Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label();
lbl.Text = "Custom Label 1";

lbl.UpdatePosition = true;
lbl.Position = Position.BottomLeft;

lbl.FontStyle.Family = "Arial";
lbl.FontStyle.Size = 8;
lbl.FontColorStyle.Color = Color.MidnightBlue;
lbl.FontStyle.Bold = true;
connector.Labels.Add(lbl);


Syncfusion.Windows.Forms.Diagram.Label lbl1 = new Syncfusion.Windows.Forms.Diagram.Label();
lbl1.Text = "Custom Label 2";

lbl1.UpdatePosition = true;
lbl1.Position = Position.BottomRight;

lbl1.FontStyle.Family = "Arial";
lbl1.FontStyle.Size = 8;
lbl1.FontColorStyle.Color = Color.MidnightBlue;
lbl1.FontStyle.Bold = true;
connector.Labels.Add(lbl1);


this.diagram1.Model.AppendChild(connector);



Thanks & Regards,
Gowri



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;