c# - 如何在 C# 中找出屏幕连接到的显卡?
解决方案
以下是@NielW 在C# 中检测哪个显卡驱动视频的代码
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
foreach (ManagementObject mo in searcher.Get())
{
PropertyData currentBitsPerPixel = mo.Properties["CurrentBitsPerPixel"];
PropertyData description = mo.Properties["Description"];
if (currentBitsPerPixel != null && description != null)
{
if (currentBitsPerPixel.Value != null)
System.Console.WriteLine(description.Value);
}
}
}
链接中进行了长时间的讨论,因为他们在获取多个显卡的名称时遇到了问题。但是这段代码应该可以工作,它会显示所有可用显卡的名称。
推荐阅读
- ios - 如何在 iPhone 中使用私有 URL 安装 .ipa 文件?
- android - 在颤动中单击底部按钮时以半屏显示选项卡
- c# - 运算符“<”不能应用于“double”和“decimal”类型的操作数
- javascript - Jquery Ajax 函数 setInterval - 控制台错误
- java - 如何在java中用布尔值编写构造函数?
- sql - 给工资> 4000美元的加薪10%,其他人加薪5%
- css - CSS 动画:永久淡出
- http - NGiNX - 重定向到 https 无法通过最初请求的子域重写/替换正确的通配符字符
- c - Linux内核模块编程中_do_fork()的问题
- c# - 统一对象位置