Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 220
sooprise Avatar asked Feb 14 '11 22:02

sooprise


1 Answers

You're looking for the PointToScreen method:

Point location = someControl.PointToScreen(Point.Empty); 
like image 103
SLaks Avatar answered Oct 11 '22 14:10

SLaks