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. Image for the cookie policy date
close icon

NodeMouseEventArgs don´t contain infos about X,Y,Button

Hi, I do have to register a lot of EventHandler on my CustomSymbol like MouseClick, MouseEnter, MouseLeave, ... . Therefore I added on the Model of my CustomSymbol the following: Model.Click += new NodeMouseEventHandler(Model_Click); Model.DoubleClick += new NodeMouseEventHandler(Model_DoubleClick); Model.MouseEnter += new NodeMouseEventHandler(Model_MouseEnter); MouseLeave += new NodeMouseEventHandler(Model_MouseLeave); My problem is that I need additional informations to the standard NodeMouseEventArgs like the position of the fired mouse event and the button (mouse right/left). How can I get this? greetz, Uli

2 Replies

AD Administrator Syncfusion Team November 23, 2005 03:20 PM UTC

Hello Ulrich, The position or cursor location of the mouse click can be determined by using the System.Cursor.Position property, and converting the obtained screen coordinates to the diagram model''s world coords using a sequence of the Control.PointToClient(PointF), diagram.View.DeviceToView(PointF) and diagram.View.ViewToWorld(PointF) methods. Getting hold of the mouse buttons for the click/doubleclick events is however going to be tricky as the Windows Forms Control.Click and Control.DoubleClick events that trigger the diagram.Model.NodeClick and NodeDoubleClick events do not provide any information about the mouse buttons. One way to determine the mouse button state, and position as well, from within the NodeClick/NodeDoubleClick handlers would be by taking advantage of the fact that the Control.MouseDown event will always be fired before the Control.Click and Control.DoubleClick events. So your application can simply provide a handler for the diagram control''s MouseDown event, and update a variable that keeps track of the mouse position and button state. You could then refer to this buttonstate information from your NodeClick/NodeDoubleClick handlers. Thanks, Prakash Surendra Syncfusion Inc.,


JS Johann Schraml November 23, 2005 04:07 PM UTC

Thanks a lot. Uli

Loader.
Live Chat Icon For mobile
Up arrow icon