本文介绍了获取控件相对于整个屏幕的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
让我们说我有一个控制,它的位置是相对于它的父。如果它嵌入很多次,是...的主要形式的伟大伟大伟大的孙子,我怎么能确定它的位置是我的整个屏幕上,不只是它的直接父?这是通过打印的截图一个特定的控制(因为某些控件不要做DrawToBitmap不能正常工作)的目的。
Let's say I have a Control, it's location is relative to it's parent. If it's embedded many times and is ... the great great great grandchild of the main form, how can I determine what it's location is on my entire screen, not just it's immediate parent? This is for the purpose of printing a particular Control via a screenshot (since some controls don't do the DrawToBitmap doesn't work properly).
推荐答案您正在寻找的PointToScreen方法:
You're looking for the PointToScreen method:
Point location = someControl.PointToScreen(Point.Empty);更多推荐
获取控件相对于整个屏幕的位置?
发布评论