Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic obtain selected node's screen coordinate (Read 1957 times)
tmtton
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
obtain selected node's screen coordinate
Dec 3rd, 2008 at 5:37pm
Print Post  
Hi, I highlight a ShapeNode upon a diagram_SelectionChanged event. I like to show a popup form on the selected node. How do I get the screen coordinates of the selected node?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: obtain selected node's screen coordinate
Reply #1 - Dec 3rd, 2008 at 6:21pm
Print Post  
Hi,

Use the DiagramView.ClientToDoc and Control.PointToScreen methods.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
tmtton
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
Re: obtain selected node's screen coordinate
Reply #2 - Dec 3rd, 2008 at 11:10pm
Print Post  
Thanks. I have the following, but it doesn't give the right coordinates.

private void diagram_SelectionChanged(object sender, EventArgs e)
{
    foreach (ShapeNode node in diagram.Selection.Nodes)
    {
        // ...
        Point pos = diagramView.PointToScreen(Cursor.Position);
        myForm.Location = pos;
        myForm.ShowDialog();
    }
}
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: obtain selected node's screen coordinate
Reply #3 - Dec 4th, 2008 at 7:42am
Print Post  
Cursor.Position is already in screen coordinates, so you don't have to call PointToScreen.

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