How to get screen coordinates of a control
i have to find out screen coordinates of upper left corner of a picture box placed on the form.
Point p = pictureBox1.PointToScreen(pictureBox1.Location);
i use PointToScreen() to get the coordiantes but these are not exact screen coordinates as i validate it by using PointToScreen() in MouseDown method and find the screen coordinates on mouse down but the coordinates are not same.
can any one helps me.
Leave a comment...
- 2 Comments
- pictureBox1.Location is picturebox top-left point in parent form coordinates. To translate it to screen coordinates, you need to call parent's function:
Point p = this->PointToScreen(pictureBox1.Location);
(Assuming that this code belongs to parent form).#1; Fri, 09 Nov 2007 01:52:00 GMT
Point p = this.PointToScreen(pictureBox1.Location);
Alexen#2; Fri, 09 Nov 2007 01:53:00 GMT