获取控件相对于整个屏幕的位置? [英] Getting The Location Of A Control Relative To The Entire Screen?

查看:254
本文介绍了获取控件相对于整个屏幕的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们说我有一个控制,它的位置是相对于它的父。如果它嵌入很多次,是...的主要形式的伟大伟大伟大的孙子,我怎么能确定它的位置是我的整个屏幕上,不只是它的直接父?这是通过打印的截图一个特定的控制(因为某些控件不要做Draw​​ToBitmap不能正常工作)的目的。

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).

推荐答案

您正在寻找的<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.control.pointtoscreen.aspx\"><$c$c>PointToScreen方法:

You're looking for the PointToScreen method:

Point location = someControl.PointToScreen(Point.Empty);

这篇关于获取控件相对于整个屏幕的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆