获取控件相对于整个屏幕的位置?

编程入门 行业动态 更新时间:2024-10-28 03:18:22
本文介绍了获取控件相对于整个屏幕的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

推荐答案

您正在寻找的PointToScreen方法:

You're looking for the PointToScreen method:

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

更多推荐

获取控件相对于整个屏幕的位置?

本文发布于:2023-05-30 09:21:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/365370.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:相对于   控件   屏幕   位置

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!