wpf 如何在 Monogame 中全屏启动?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15301735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to start in full screen in Monogame?
提问by Dino Sauro
I'm developing a game using Monogame and C#. I have a wpf application for the menu that starts in full screen. When I click on play on the menu, I go to the Monogame project. How can I start the Monogame solution in full screen like I do with the wpf menu?
我正在使用 Monogame 和 C# 开发游戏。我有一个全屏启动菜单的 wpf 应用程序。当我点击菜单上的 play 时,我会转到 Monogame 项目。如何像使用 wpf 菜单那样全屏启动 Monogame 解决方案?
回答by keyboardP
You can set the IsFullscreenproperty to true.
您可以将该IsFullscreen属性设置为true.
//you likely already have this line (or similar)
graphics = new GraphicsDeviceManager(this);
//set the GraphicsDeviceManager's fullscreen property
graphics.IsFullScreen = true;
回答by Xavier XB
This is the right way with monogame
这是monogame的正确方法
GraphicsDeviceManager graphics;
graphics = new GraphicsDeviceManager(this);
graphics.ToggleFullScreen();
回答by Moritz
There are two ways to make the application fullscreen. One is by setting the IsFullScreenproperty, the other is by calling the ToggleFullScreenMethod.
有两种方法可以使应用程序全屏显示。一种是通过设置IsFullScreen属性,另一种是通过调用ToggleFullScreen方法。
Keep in mind that, according to the documentation, if you change the property during initialization this will automatically set fullscreen mode. But when changing the property, not in initialization, that you need to call the ApplyChangesmethod.
请记住,根据文档,如果您在初始化期间更改属性,这将自动设置全屏模式。但是在更改属性时,而不是在初始化时,您需要调用该ApplyChanges方法。
// probably already defined
graphics = new GraphicsDeviceManager(this);
// ...
graphics.IsFullScreen = true;
// don't forget to call ApplyChanges, if you are not in the Initialize method
graphics.ApplyChanges();
// probably already defined
graphics = new GraphicsDeviceManager(this);
// ...
graphics.ToggleFullScreen();

