In order to be able to embed the window in a winforms panel I'd like to run some pinvoke over the window handle after it is created. Is there a way to get it?
Nevermind, I found out how.
Basically if anybody needs to put the game in a WinForms panel, all they have to do is this after the game has been created and before it is run:
IntPtr winHandle = game.Window.Handle;
game.Window.IsBorderless = true;
game.IsMouseVisible = true;
Win32.SetWindowPos(
winHandle,
IntPtr.Zero,
0,
0,
0,
0,
0x0401 // NOSIZE | SHOWWINDOW
);
Win32.SetParent(winHandle, winFormsPanel.Handle);
Win32.SetWindowLong(winHandle, -20, 0x08000000); // WS_EX_NOACTIVATE, to prevent parent window from being deactivated when this window is clicked, yet keep receiving input
Win32.ShowWindow(winHandle, 1); // SHOWNORMAL
Followed by setting the game backbuffer size to the panel control size on each resize.
Issues should be used for Bug tracking / Feature requests. If you have general questions about the framework please use MonoGame Community SIte or Gitter.
Most helpful comment
Nevermind, I found out how.
Basically if anybody needs to put the game in a WinForms panel, all they have to do is this after the game has been created and before it is run:
Followed by setting the game backbuffer size to the panel control size on each resize.