Mouse.WindowHandle different from XNA.


Hello everyone,

First time writing here and english is not my native language so, sorry about that.

I was trying to use an tutorial that explains how to integrate XNA inside a WinForm, and found a little difference between the "Mouse" class from XNA and MonoGame:

From XNA:
// Summary:
// Gets or sets the window used for mouse processing. Mouse coordinates returned
// by GetState are relative to the upper-left corner of this window. Reference
// page contains links to related code samples.
public static IntPtr WindowHandle { get; set; }

From MonoGame:
public static IntPtr WindowHandle { get; }

So, as you can see, WindowHandle on XNA is possible to be set... and it's kind of important to define the "bounds" of the game inside the form. Well, nothing so big but I guess that would be good to tell.

If this is on the wrong place, tell me so I can change it.

Luciano Lima. :D
Closed May 28, 2016 at 7:53 PM by TomSpilman


lextm wrote Feb 3, 2013 at 3:28 AM


From the source code you can see this is by design,


Though WindowHandle is exposed, it is not even implemented.

Uriann wrote Feb 3, 2013 at 1:21 PM

Oh, damn. lol

Thanks man.
I was trying to use it from a tutorial... well, I guess I'll have to try another way to map the mouse inside the image on the form, but thats ok.

Thanks for the link though. :D

wrote Feb 22, 2013 at 1:56 AM

wrote May 28, 2016 at 7:53 PM