XNA losing title bar theme on fullscreen->windowed transition
(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 blu开发者_如何学JAVAe 'basic' title border.
How can I set the theme or style of this back to the Aero style?
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.
This will help:
System.Windows.Forms.Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.ClientAndNonClientAreasEnabled;
精彩评论