There are a lot of code format errors in the code provided in Examples. Such as: // method to convert the Control's client coordinates // to screen coordinates. Rectangle controlRectangle; for(int i = 0; i < Controls.Count; i++) Please check it. Doc link: [Control.PointToScreen(Point) Method](https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.control.pointtoscreen?view=netframework-4.8)