XNA losing title bar theme on fullscreen->windowed transition

后端 未结 2 717
南方客
南方客 2021-01-22 18:31

(I think Aero is the term).

When I start my XNA program in Windowed mode, I have the glossy bar as seen on Win7/Vista programs.

When I set to fullscreen and then

相关标签:
2条回答
  • 2021-01-22 19:23

    If you call the following before switching back to windowed mode, you will get the Aero style, but it requires you reference System.Windows.Forms.

    System.Windows.Forms.Application.EnableVisualStyles();
    

    I'm not certain if that's the best way to do it, but it works. I've used it in my XNA games.

    As an example you can hang it off your Game class:

    public class FooGame : Game
    {
        ... 
    
        private void SetWindow(bool fullscreen)
        {
            if(!fullscreen)
            {
                System.Windows.Forms.Application.EnableVisualStyles();
            }
    
            this.graphicsDeviceManager.IsFullScreen = fullscreen;
            this.graphicsDeviceManager.ApplyChanges();
        }
    }
    

    Good luck.

    0 讨论(0)
  • 2021-01-22 19:26

    This will help:

    System.Windows.Forms.Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.ClientAndNonClientAreasEnabled;

    0 讨论(0)
提交回复
热议问题