访问用户可能的屏幕分辨率 - C# 2010
预先感谢您的帮助。
我想知道如何访问用户电脑上可用的屏幕分辨率。我想获取所有可用分辨率的列表,并确定用户当前运行的分辨率。
Thanks in advance for your help.
I am wondering how I might go about accessing the screen resolutions available on a user's PC. I would like to get a list of all available resolutions and also determine what the user is current running at.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信您可以对 User32.dll 中的 EnumDisplaySettings api 调用进行 PInvoke 调用。
请参阅此处示例。
您当然会遇到双显示器系统的复杂情况,但要获取当前屏幕,您可以做
我假设您正在谈论可执行文件而不是 ASP.Net 应用程序,但如果您需要 Javascript 中的屏幕尺寸,您可以可以使用屏幕对象。
I believe you can make a PInvoke call to EnumDisplaySettings api call in User32.dll.
See example here.
You'll of course run into complications with dual-monitor systems, but to get the current screen you can do
I assumed you were talking about an executable and not an ASP.Net app, but if you need the screen size in Javascript, you can use the screen object.
您可以使用 Microsoft.Win32
RegestryKey
类从注册表中获取当前屏幕尺寸。我会在那里寻找你想要的东西,但我不会弄乱他们在那里的任何设置。
You could use the Microsoft.Win32
RegestryKey
class to fetch the current screen size from the registry.I'd hunt around there to find what you want, but I wouldn't mess with whatever settings they have in there.