Getting The Location Of A Control Relative To The Entire Screen?

C#WinformsControlsLocation

C# Problem Overview


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

C# Solutions


Solution 1 - C#

You're looking for the PointToScreen method:

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsoopriseView Question on Stackoverflow
Solution 1 - C#SLaksView Answer on Stackoverflow