XNA losing title bar theme on fullscreen->windowed transition

倖福魔咒の 提交于 2019-12-02 07:11:51

问题


(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 revert, I will have a plain blue 'basic' title border.

How can I set the theme or style of this back to the Aero style?


回答1:


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.




回答2:


This will help:

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



来源:https://stackoverflow.com/questions/6885363/xna-losing-title-bar-theme-on-fullscreen-windowed-transition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!