如何在XNA中最大化窗口

Fro*_*bot 2 c# xna window maximize

这应该是一个非常简单的问题,但经过大量的搜索,似乎没有任何工作的例子.我只是希望我的XNA窗口开始最大化.我知道如何设置窗口的宽度和高度,但这并不完全相同.我还需要在不全屏的情况下这样做.我只想要一个普通的最大化窗口.

asa*_*yer 5

IsFullScreen图形设备管理器的属性设置为true.

http://msdn.microsoft.com/en-us/library/bb195024(v=xnagamestudio.10).aspx

    //from the above msdn sample
    graphics = new GraphicsDeviceManager( this );
    content = new ContentManager( Services );

    graphics.PreferredBackBufferWidth = 800;
    graphics.PreferredBackBufferHeight = 600;
    graphics.PreferMultiSampling = false;
    graphics.IsFullScreen = true;
Run Code Online (Sandbox Code Playgroud)

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphicsdevicemanager.isfullscreen(v=xnagamestudio.10).aspx

  • 您可能还需要调用`graphics.ApplyChanges();` (2认同)