Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic MouseHover on a ShapeNode (Read 1024 times)
tmtton
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
MouseHover on a ShapeNode
Dec 5th, 2008 at 4:57pm
Print Post  
I want to obtain a ShapeNode under the cursor when the mouse hovers over it. The following code doesn't work for me (hoveredNode is null).

diagramView1.MouseHover += new System.EventHandler(diagramView1_MouseHover);

private void diagramView1_MouseHover(object sender, EventArgs e)
{
   Point clientPoint = Control.MousePosition;
   PointF documentPoint = diagramView1.ClientToDoc(clientPoint);
   DiagramNode hoveredNode = diagram1.GetNodeAt(documentPoint, false, false);
   if (hoveredNode is ShapeNode)
   {
      Console.WriteLine("...");
    }
}
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: MouseHover on a ShapeNode
Reply #1 - Dec 7th, 2008 at 8:35am
Print Post  
Control.MousePosition is in screen coordinates. convert it to client coordinates using DiagramView.PointToClient before calling ClientToDoc.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint