给定屏幕的有效分辨率列表?
有没有办法获得给定屏幕的所有有效分辨率?
我目前有一个填充了所有有效屏幕的下拉菜单(使用Screen.AllScreens)。当用户选择一个屏幕时,我想向他们展示第二个下拉列表,列出该显示器的所有有效分辨率(不仅仅是当前分辨率)。
Is there a way to get ALL valid resolutions for a given screen?
I currently have a dropdown that is populated with all valid screens (using Screen.AllScreens). When the user selects a screen, I'd like to present them with a second dropdown listing all valid resolutions for that display (not just the current resolution).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为应该可以使用 Windows Management Instrumentation (WMI) 获取信息。可以使用其中的类从 .NET 访问 WMI System.Management 命名空间。
解决方案将类似于以下内容。我不太了解 WMI,无法立即找到您要查找的信息,但我找到了显卡支持的分辨率的 WMI 类。该代码需要引用 System.Management.dll 并导入 System.Management 命名空间。
I think it should be possible to get the information using Windows Management Instrumentation (WMI). WMI is accessible from .NET using the classes from them System.Management namespace.
A solution will look similar to the following. I don't know WMI well and could not immediately find the information you are looking for, but I found the WMI class for the resolutions supported by the video card. The code requires referencing System.Management.dll and importing the System.Management namespace.
以下链接包含详细的代码示例:
任务 2:更改显示分辨率
http://msdn.microsoft.com/en -us/library/aa719104(VS.71).aspx#docum_topic2
The following link contains detailed code examples for this:
Task 2: Changing the Display Resolution
http://msdn.microsoft.com/en-us/library/aa719104(VS.71).aspx#docum_topic2
接受的答案似乎不适用于 Windows 8.1,至少在我的机器上。查询运行正常,但结果中有 0 个条目。考虑到 Bijoy K Jose 的评论,我想我不是唯一的一个。
然而,以下问题的经过验证的答案效果很好:
如何使用 C# 列出可用的视频模式?
感谢 Vimvq1987
The accepted answer doesn't seem to work on Windows 8.1, at least on my machine. The query runs fine but there are 0 entries in the results. And considering Bijoy K Jose's comment I suppose that I am not the only one.
However the validated answer for the following question worked out just fine :
How to list available video modes using C#?
Thanks to Vimvq1987