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.

Connecting Diagram to Events

Thread ID:

Created:

Updated:

Platform:

Replies:

65575 Jul 26,2007 12:36 PM Jul 27,2007 02:01 PM Windows Forms 1
loading
Tags: Diagram
Dan Harris
Asked On July 26, 2007 12:36 PM

Can I get some samples (in vb) of connecting object in the diagram to events.

What I want to be able to do is take a specific Object on the Diagram and detecting when the mouse is over it or the user clicks the object.

The idea is to use the "diagram" as a connection to a database to pull out real world data points about the object represented on the screen.

I'm not talking about the properties of the object. I want to have my users click on an object and display info from my database about the object. Or said another way I want to be able to pull details about what the object represents in the real world.

Make sense????

Dan

J.Nagarajan [Syncfusion]
Replied On July 27, 2007 02:01 PM

Hi Dan,

If you want to fire a event when you select the node then you have write your own delegate. Please refer to the following code snippet

Public Delegate Sub NodeSelection(ByVal sender As Object, ByVal evtargs As CollectionExEventArgs)
Public Event evtnodeselection As NodeSelection

AddHandler evtnodeselection, AddressOf MainForm_evtnodeselection

'Fire the NodeSelection Event
Private Sub MainForm_evtnodeselection(ByVal sender As Object, ByVal evtargs As CollectionExEventArgs)
Dim node As Node = CType(IIf(TypeOf evtargs.Element Is Node, evtargs.Element, Nothing), Node)
Console.WriteLine(node.Name)
End Sub

'NodeCollectionChanged event
Private Sub EventSink_NodeCollectionChanged(ByVal evtArgs As CollectionExEventArgs)
Dim controller As DiagramController = Me.diagram1.Controller
Dim node As Node = CType(IIf(TypeOf evtArgs.Element Is Node, evtArgs.Element, Nothing), Node)
If Not node Is Nothing Then
If node Is controller.SelectionList.First Then
'Fire the NodeSelection event
RaiseEvent evtnodeselection(Me, evtArgs)
End If
End If
End Sub

I have attached the sample that demonstrates this completely.

http://websamples.syncfusion.com/samples/Diagram.Windows/F65575/main.htm

Please refer to the sample and let me know if you have any questions.

Thanks,
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.

;