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.

Linking

Thread ID:

Created:

Updated:

Platform:

Replies:

51979 Nov 17,2006 03:23 PM Dec 12,2006 06:36 PM Windows Forms 5
loading
Tags: Diagram
Rob
Asked On November 17, 2006 03:23 PM

Hi,

Could you help me determine how to link two ports dynamically such that all the user has to do is
a) click port a
b) click port b
c) link appears

I don't want to have to select a link tool prior to this, as per your included examaples. I'll be adding checking into this to ensure that the two ports are "compatible" so any hints on a efficient way to do this would be very much appreciated!

Thanks for your help
Rob

Anonymous
Replied On November 17, 2006 03:39 PM

ps...

It'd also be nice to have the blinking line indicating a link is taking place with the above example...

kind regards
Rob

Anonymous
Replied On November 17, 2006 03:40 PM

ps...

It'd also be nice to have the blinking line indicating a link is taking place with the above example...

kind regards
Rob

J.Nagarajan [Syncfusion]
Replied On November 20, 2006 05:08 PM

Hi Rob,

If your intention is to add a link dynamically then you can use LinkCmd class. Please refer to the following code snippet

LinkCmd linkcmd = new LinkCmd();
Link link = new Link(Link.Shapes.OrthogonalLine);
link.EndPoints.LastEndPointDecorator = new EndPointDecorator(EndPointVisuals.ClosedArrow);
link.EndPoints.LastEndPointDecorator.FillStyle.Color = Color.Black;
linkcmd.SourcePort = rectangle.CenterPort;
linkcmd.TargetPort = roundrect.CenterPort;
linkcmd.Link = link;
this.diagram1.Controller.ExecuteCommand(linkcmd);

Please refer to the attached sample. In this sample when you click on the "Add Symbols" button you can get 2 symbols on the diagram and click on the "AddLink" button to create a link between these two symbols.

We are currently working on to create the link as a blinking line. We will update you at the earliest.

Regards,
Nagaraj

Dynamic Link.zip


Administrator [Syncfusion]
Replied On December 12, 2006 03:01 PM

I saw your post and thought I'd share with you how we did this in our application. We have a large app with derived model, diagram and controller classes. We also have custom symbols and links. We used the following override in our controller class to do a "hit test" for a port to activate the link tool. It makes the step of activating the link tool look seamless to the user.

protected override void OnMouseDown(object sender, MouseEventArgs evtArgs)
{
if (evtArgs.Button == MouseButtons.Left)
{
// Check to see if there is a port at this location
Port port = this.View.GetPortAt(new Point evtArgs.X, evtArgs.Y), 0);

// Activate the link tool if there is a port and it is valid
if (port != null)
{
if (port.GetType() == typeof(CirclePort))
{
this.ActivateTool("LinkTool");
}
}
}

base.OnMouseDown(sender, evtArgs);
}

(We're still using 4.1, with no plans to upgrade in the near future.)

Chris C.


>Hi,

Could you help me determine how to link two ports dynamically such that all the user has to do is
a) click port a
b) click port b
c) link appears

I don't want to have to select a link tool prior to this, as per your included examaples. I'll be adding checking into this to ensure that the two ports are "compatible" so any hints on a efficient way to do this would be very much appreciated!

Thanks for your help
Rob

J.Nagarajan [Syncfusion]
Replied On December 12, 2006 06:36 PM

Hi Chris ,

We regret for the inconvenience caused. I have tested this issue in v.4.1.0.52 . I am afraid, I was not able to reproduce this issue. I have attached my test sample.

CustomOrthogonalLink_Sample.zip

Could you please check the sample and let me know whether you are able to reproduce the issue in this sample?. It would be helpful if you provide a sample or modify the sample attached to reproduce this issue.It will help us to resolve it as early as possible.

Thanks for using Essential Diagram.

Regards,
J.Nagaraj

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.

;