Implement PointToScreen via poor man's method of just inverting result from PointToClient.

This commit is contained in:
kanato 2009-05-11 02:18:22 +00:00
parent d272d0b15c
commit 57bd7e623e

View file

@ -1365,7 +1365,7 @@ namespace OpenTK
#endregion #endregion
#region PointToScreen #region PointToScreen
#if false // Todo: Linux / Mac OS X support missing.
/// <summary> /// <summary>
/// Converts the client-area coordinates of a specified point to screen coordinates. /// Converts the client-area coordinates of a specified point to screen coordinates.
/// </summary> /// </summary>
@ -1373,9 +1373,14 @@ namespace OpenTK
/// <returns>The screen coordinates of the point, relative to the upper-left corner of the screen. Note, a screen-coordinate point that is above the window's client area has a negative y-coordinate. Similarly, a screen coordinate to the left of a client area has a negative x-coordinate.</returns> /// <returns>The screen coordinates of the point, relative to the upper-left corner of the screen. Note, a screen-coordinate point that is above the window's client area has a negative y-coordinate. Similarly, a screen coordinate to the left of a client area has a negative x-coordinate.</returns>
public System.Drawing.Point PointToScreen(System.Drawing.Point p) public System.Drawing.Point PointToScreen(System.Drawing.Point p)
{ {
return glWindow.PointToScreen(p); // Here we use the fact that PointToClient just translates the point, and PointToScreen
// should perform the inverse operation.
System.Drawing.Point trans = PointToClient(System.Drawing.Point.Empty);
p.X -= trans.X;
p.Y -= trans.Y;
return p;
} }
#endif
#endregion #endregion
#region --- IDisposable Members --- #region --- IDisposable Members ---