Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
GetNodeFromPoint brings back wrong node
posted

I'm getting some strange behaviour when getting a node back using GetNodeFromPoint().

It's bringing back the wrong node.  Here is the result of two commands I typed into the immediate window to prove the point...

? pointInTree
{X = 79 Y = 335}
    IsEmpty: false
    X: 79
    Y: 335

? this.Tree.GetNodeFromPoint(pointInTree).Bounds
{X = 1 Y = 301 Width = 479 Height = 20}
    Bottom: 321
    Height: 20
    IsEmpty: false
    Left: 1
    Location: {X = 1 Y = 301}
    Right: 480
    Size: {Width = 479 Height = 20}
    Top: 301
    Width: 479
    X: 1
    Y: 301

As you can see the Point I passed in is not within the resulting node.  The resulting node goes from a Y of 301 to 321.  The point I passed in has a Y of 335 which would be the node underneath the one I got back.

Under what circumstances could this method bring back the wrong node?

Thanks,

 

Paul