Find Coordinates for point on screen?

c#, coordinates, graphics, point

Solution

Each control hs PointToFoo methods for conversion. Note that you should call this from the parent of the object who's location you want:

Point scrPos = this.PointToScreen(panel1.Location);

Alternatively, you can get the panel's screen coordinates with:

Point scrPos = panel1.PointToScreen(new Point(0,0));

Note that the above two examples could gve different result due to the border-size of the panel.

Problem

The thing is I have some graphics shown in a form, rectangle for example, and I want to capture when the point gets over thees fields. So I Thoght I try to find the corrrdinates for thees rectangles, but as thay are the coords in the form it dose not match the ones with the mouse location. So I wonder is there a way to find what coord on the screen a Point has on the screen and not in the form or controller?

Original source