Proper graphic coordinates

G

Guest

I have a form containing a TreeView control in which I've overriden the
OnResize and WndProc functions and added a PaintEventHandler. One thing I
want to do is use DrawReversibleLine for 'rubberbanding' lines connecting
specific nodes with other controls on the form. DrawReversibleLine expects
the start and end points to be passed as screen, rather than client,
coordinates, so I'm passing the coordinates using PointToScreen( ) as
arguments to the function. Regardless, when I call DrawReversibleLine,
passing it the starting coordinate of the node (a point 3 pixels to the right
of the node and midway between the top and bottom of the node), the start
point of the line ends up being roughly 34 pixels closer to the top of the
screen than it should be. I could cludge it and add 34 to the Y-coordinate
prior to calling PointToScreen( ), but there has to be a better answer; I
just can't come up with it. Is there one?
 
G

Guest

That's it! Thanks! Don't know why I didn't think of it as I'd used
"this.PointToScreen" when it should've been "this.treeView1.PointToScreen".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top