我正在以这种方式改变窗口大小:
m_GraphicsDeviceManager.PreferredBackBufferWidth = (int)i_NewSize.X;
m_GraphicsDeviceManager.PreferredBackBufferHeight = (int)i_NewSize.Y;
m_GraphicsDeviceManager.ApplyChanges();
答案 0 :(得分:1)
您可以添加对System.Windows.Forms的引用,从窗口句柄中获取Form对象,保存位置,更改设置,然后重新定位窗口。
这样的事情:
var form = Form.FromHandle(Window.Handle);
var location = form.Location;
m_GraphicsDeviceManager.PreferredBackBufferWidth = (int)i_NewSize.X;
m_GraphicsDeviceManager.PreferredBackBufferHeight = (int)i_NewSize.Y;
m_GraphicsDeviceManager.ApplyChanges();
form.Location = location;
我没有测试过这个,所以没有保证:)