2
我正嘗試將XNA遊戲移植到MonoGame。我只想定位Windows平臺。 我想在無邊框窗口中顯示遊戲。我這樣做,在我的XNA遊戲中:無邊界窗口monogame
private void SetForm()
{
Form myForm = (Form)Form.FromHandle(this.Window.Handle);
myForm.Name = "WIPForm";
int width = 1024;
int height = 768;
IntPtr auxptr = (this.Window.Handle);
SafeNativeMethods.MoveWindow(
(int)auxptr,
0,
0,
Properties.Settings.Default.width,
Properties.Settings.Default.height,
1);
myForm.FormBorderStyle = FormBorderStyle.None;
myForm.SetBounds(0, 0, width, height);
}
當我在monogame版本中測試此代碼時myForm = null。 有沒有什麼辦法可以在monogame版本中繪製無邊框窗口?
所以Monogame不給你你的遊戲窗口的句柄?也許有一些特定的方法來獲得窗口句柄,因爲代碼似乎沒問題。 – user1306322
嘗試使用'Mouse.WindowHandle'。 – user1306322