How do i get the location of a control in screen coordinates?
-
The reason: I made a tooltip control that doesn't rely on dllimports at all which is pretty cool i think :D and i want the control to appear below whatever button summons...I don't want to just use mouseposition and load it where the mouse clicks because that would look unprofessional i think. The question: How to i get the location of a control relative to its position on the screen. I was thinking of somehow determining incremently all the outermost parents that encase the button that i want the screen coords of and adding up some stuff... Are their any cleaner methods?
-
The reason: I made a tooltip control that doesn't rely on dllimports at all which is pretty cool i think :D and i want the control to appear below whatever button summons...I don't want to just use mouseposition and load it where the mouse clicks because that would look unprofessional i think. The question: How to i get the location of a control relative to its position on the screen. I was thinking of somehow determining incremently all the outermost parents that encase the button that i want the screen coords of and adding up some stuff... Are their any cleaner methods?
Something like this maybe... Point screenPt = control.Parent.PointToScreen(control.Location);
-
Something like this maybe... Point screenPt = control.Parent.PointToScreen(control.Location);
TY! worked perfectly :P Here's the code i used to put it below the button Point spot = this.button1.Parent.PointToScreen(this.button1.Location); this.panelbar.Left = spot.X; this.panelbar.Top = spot.Y + this.button1.Height;