Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何获得屏幕的显示深度?_C#_Winforms_Screen - Fatal编程技术网

C# 如何获得屏幕的显示深度?

C# 如何获得屏幕的显示深度?,c#,winforms,screen,C#,Winforms,Screen,如何获得屏幕的颜色?我想知道屏幕是设置为真彩色(32位)还是高彩色(16位) 我一直在谷歌上搜索,觉得很容易找到,但我什么也找不到(也许我需要学习谷歌技能?你可以使用该属性: int bitsPerPixel = Screen.PrimaryScreen.BitsPerPixel; 我想DirectX9API中的GetDisplayMode函数可以帮助您。在包含必要的头之后,您只需编写两条语句 D3DDISPLAYMODE currentMode; pDevice->GetDisplay

如何获得屏幕的颜色?我想知道屏幕是设置为真彩色(32位)还是高彩色(16位)

我一直在谷歌上搜索,觉得很容易找到,但我什么也找不到(也许我需要学习谷歌技能?

你可以使用该属性:

int bitsPerPixel = Screen.PrimaryScreen.BitsPerPixel;

我想DirectX9API中的GetDisplayMode函数可以帮助您。在包含必要的头之后,您只需编写两条语句

D3DDISPLAYMODE currentMode;
pDevice->GetDisplayMode(0,&currentMode);
之后,您可以检查深度值,如

currentMode->Format
我肯定还有其他WinAPI函数,但我只知道这些


编辑:没有看到您提到的Winforms。这是没有用的

我也会写同样的。另外,如果有人想知道,完整的名称是System.Windows.Forms.Screen