如何在XNA/Monogame中获得显示分辨率?我在我的显示器上尝试了这些(1600x900):
下面给我800,600
//1.
GraphicsDevice.DisplayMode.Width
GraphicsDevice.DisplayMode.Height
//2.
GraphicsDeviceManager graphics = new GraphicsDeviceManager(this);
graphics.GraphicsDevice.DisplayMode.Width
graphics.GraphicsDevice.DisplayMode.Height
//3.
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height
//4.
foreach (DisplayMode dm in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
{
Console.WriteLine(dm.Width);
Console.WriteLine(dm.Height);
}
Run Code Online (Sandbox Code Playgroud)
dim*_*s93 10
_ScreenWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
_ScreenHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
Run Code Online (Sandbox Code Playgroud)
额外的引用:System.Drawing,System.Windows.Forms
| 归档时间: |
|
| 查看次数: |
13135 次 |
| 最近记录: |