Find coordinates for a point on the screen?

The fact is that I have a graphic depicted in a shape, such as a rectangle, and I want to capture when the point overflows thees fields. Thus, I am trying to find the bullfights for these rectangles, but since they are shape coords, they do not correspond to those who have the mouse location.

So, I wonder if there is a way to find which coordinate on the screen the Point has on the screen, and not in the form or controller?

+3
source share
3 answers

Each hs PointToFoo method to convert. Note that you must call this from the parent of the object you want:

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

:

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

, - .

+7

, this.CreateGraphics() , , , , , click .

0

, ? GetWindowRect() / , .

It seems that I remember that there is a function to do this for you actually, but some time has passed since I worked in user controls for the graphical interface.

0
source

Source: https://habr.com/ru/post/1717918/


All Articles