PointToClient
时间: 2023-12-31 17:03:57 浏览: 64
PointToClient is a method in WinForms that is used to convert screen coordinates to client coordinates. It takes a Point object as a parameter which represents the screen coordinates and returns a Point object which represents the client coordinates.
For example, if you have a form with a button located at screen coordinates (100, 100) and you want to find out its client coordinates, you can use the PointToClient method:
```
Point screenPoint = new Point(100, 100);
Point clientPoint = this.PointToClient(screenPoint);
```
The clientPoint variable will contain the client coordinates of the button. The PointToClient method takes into account any scrolling or zooming of the form, so it will give you accurate client coordinates even if the form is not at its default size or position.
阅读全文