Getting The Location Of A Control Relative To The

2020-01-28 04:37发布

Let's say I have a Control and its location is relative to its parent. If its embedded many times and is the great great great grandchild of the main form, how can I determine what its location is on my entire screen, not just its location in the immediate parent? This is for the purpose of printing a particular Control via a screenshot (since for some controls the DrawToBitmap doesn't work properly).

1条回答
来,给爷笑一个
2楼-- · 2020-01-28 04:55

You're looking for the PointToScreen method:

Point location = someControl.PointToScreen(Point.Empty);
查看更多
登录 后发表回答