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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Connecting Diagram to Events

Thread ID:





65575 Jul 26,2007 04:36 PM UTC Jul 27,2007 06:01 PM UTC WinForms 1
Tags: Diagram
Dan Harris
Asked On July 26, 2007 04:36 PM UTC

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????


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

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)
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.


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



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon