Windows:如何测试高dpi下的UI?
我想测试我的应用程序对高-dpi 设置的反应。 我指的不仅仅是 120dpi。 我想测试更高的 dpi 设置,例如:
- 150dpi
- 300dpi
- 600dpi
- 1000dpi
- 1200dpi
我的开发机器的显卡无法达到 300dpi 所需的分辨率(甚至 150dpi)。
假设界面设计为“适合”768 行显示屏(例如 1024x768),则较高 dpi 设置所需的分辨率为:
Normal Wide-Screen Frame Buffer
dpi Resolution Resolution Zoom Size (MiB)
======= ============ ============ ====== ============
96 1024 x 768 1280 x 768 100% 3.75
113 1200 x 900 1440 x 900 117% 4.96
120 1280 x 960 1536 x 960 125% 5.63
131 1400 x 1050 1680 x 1050 137% 6.73
150 1600 x 1200 1920 x 1200 156% 8.70
300 3200 x 2400 3840 x 2400 313% 35.26
600 6400 x 4800 7680 x 4800 625% 140.63
1,000 10667 x 8000 12800 x 8000 1,042% 390.63
即使在 150dpi 下,所需的分辨率也相当高。
我正在考虑在 VirtualPC 上运行软件,虚拟机运行 6400x4800 - 然后使用 VNC连接到虚拟机。 然后它可以缩放内容以适合我的显示器。 虽然我失去了高 dpi 显示器的保真度,但我至少可以查看它,与其交互(即测试它)。 但 VirtualPC 模拟的 s3 Trio 32/64 显卡的最高分辨率为 1600x1200(即 150dpi)。
我还想知道是否有一些虚拟视频卡驱动程序,它可以像视频卡一样工作 - 具有高分辨率,但在我的本机桌面上显示自身缩放。
有任何想法吗?
参考文献
i want to test how my application reacts to high-dpi settings. i don't just mean 120dpi. i want to test higher dpi settings, such as:
- 150dpi
- 300dpi
- 600dpi
- 1000dpi
- 1200dpi
My development machine's video card cannot do the resolutions required to have 300dpi, (or even 150dpi for that matter).
Assuming the interface is designed to 'fit' on a display with 768 lines (e.g. 1024x768), the resolution required for the higher-dpi settings would be:
Normal Wide-Screen Frame Buffer
dpi Resolution Resolution Zoom Size (MiB)
======= ============ ============ ====== ============
96 1024 x 768 1280 x 768 100% 3.75
113 1200 x 900 1440 x 900 117% 4.96
120 1280 x 960 1536 x 960 125% 5.63
131 1400 x 1050 1680 x 1050 137% 6.73
150 1600 x 1200 1920 x 1200 156% 8.70
300 3200 x 2400 3840 x 2400 313% 35.26
600 6400 x 4800 7680 x 4800 625% 140.63
1,000 10667 x 8000 12800 x 8000 1,042% 390.63
The required resolutions get pretty high, even at 150dpi.
i was thinking of something along the line of a running the software on a VirtualPC, with the virtual machine running 6400x4800 - and then use VNC to connect to the virtual machine. It could then scale the content to fit my monitor. Although i lose the fidelity of a high-dpi display, i can at least look at it, interact with it (i.e. test it). But the s3 Trio 32/64 video card that VirtualPC emulates tops out at 1600x1200 (i.e. 150dpi).
i also wondered if maybe there is some virtual video card driver out there, that can act like a video card - capable of high-resolution, but displays itself scaled on my native desktop.
Any ideas?
References
- MSDN - How to Ensure That Your Application Displays Properly on High-DPI Displays
- MSDN: Writing High-DPI Win32 Applications
- MSDN: Tutorial: Writing High-DPI Win32 Applications
- MSDN - Pixel Density and Usability
- Engineering Windows 7 Blog: Follow-up on High DPI resolution
- Greg Schechter's Blog - High DPI Support in Windows Vista Aero
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您的应用程序的布局在 96、120、144、150 dpi 下的行为相同,那么我认为无需测试更高的 DPI,因为您已经测试过它对于不均匀的 dpi 增量也能很好地工作。
实际上,市场上已经有许多高 dpi 友好的设置,例如笔记本电脑中 16" 显示屏的 1680x1050 15,4" 或 1920x1080,在 120dpi 下已经出现像素依赖性问题,并且在 96dpi 下使用已经非常不舒服,所以致力于更高密度的显示支持是有效的。 对你有好处!
编辑:我一直在想。 这可能不是很实时,但如果您尝试处理
WM_PRINT
或WM_PRINTCLIENT
消息并将其打印到文件中,或者至少尝试使用打印机设置显示它们的打印预览? 突然我们的分辨率至少达到了 300dpi。 只是一个想法。If your app's layout behaves the same at 96, 120, 144, 150 dpi then I think there's no need to test it for even higher DPI, since you will have already tested that it works well for uneven dpi increments.
Actually there are many setups high-dpi-friendly already on the market, like 1680x1050 15,4" or 1920x1080 at 16" displays in notebooks, which at 120dpi already show pixel-dependency problems and are pretty uncomfortable to work with at 96dpi already so working on higher-density display support is valid. Good for you!
Edit: I've been thinking. That may not be very real-time, but maybe if you tried handling
WM_PRINT
orWM_PRINTCLIENT
messages in your windows and printed it to a file or at least tried to show a print preview of them using printer settings? Suddenly we're in at least 300dpi. Just an idea.我刚刚用 VirtualBox 尝试过,可以报告以下内容:
由于 Windows Vista 引入了新的驱动程序模型,因此如果 Vista/Windows 7 也支持这些高分辨率,我不会感到惊讶。 不幸的是,我没有 Vista 或 Windows 7 主机来亲自测试这一点。
必要的步骤如下:
这将绘制主机显示器的缩放版本,因此无需使用 RDP 技巧。 它还确保有限的窗口大小不会迫使虚拟机降低屏幕分辨率
使用命令行工具
VBoxManage
到指定解析提示:I've just tried this with VirtualBox can report the following:
Since Windows Vista introduced a new driver model, I wouldn't be suprised if Vista/Windows 7 support those high resolutions as well. Unfortunately I don't have a Vista or Windows 7 host to test this myself.
The necessary steps are the following:
this will draw a scaled version of the host display, so there's no need to use the RDP-trick. It also ensures that limited window size won't force the VM to reduce the screen resolution
Use the command-line tool
VBoxManage
to specify the resolution hint:您需要一个显卡和一个支持 1920 x 1200 的显示器。许多用户都有这些,如果您是开发人员,使用它们会很有趣。 如果您拥有 1600 x 1200 分辨率并且不想花钱购买新显示器,那也可以。 除此之外,除非你为皮克斯工作,否则我认为没有必要。
You need a video card and a monitor that supports 1920 x 1200. Many users have these, and they're a joy to use if you're a developer. If you have 1600 x 1200 and don't want to spend the money on a new monitor that's fine. Beyond that, unless you're working for Pixar, I don't see the need.
正如您所知,NVidia 和 ATI 显卡都允许您创建自定义分辨率,但在一百万年内都无法达到 12800 x 8000。只是为了让您了解需要多少内存......需要 1080 (1920x1200) 显卡的 45 倍内存。 然而,您可以做的是获得一个大的鸣叫装置并将许多卡链接在一起......即使如此......12800 x 8000 将更适合 LINUX 下的客户硬件和驱动程序。
As you're already aware, both the NVidia and ATI display cards allow you to create custom resolutions however never in a million years up to 12800 x 8000. Just to give you an idea of how much memory that would take ... it would require 45 times as much memory as a 1080 (1920x1200) video card. What you could do however is get a big honking rig and chain numerous cards together ... even still ... 12800 x 8000 would be something better suited for customer hardware and drivers under LINUX.
Windows 不会检查您的显示器是否实际测量到您配置的 DPI,因此只需连接尽可能大的显示器并开始切换设置即可。
我很好奇为什么你想测试这么高分辨率,即超过 192 的分辨率。如果你确实需要这么高分辨率,你肯定可以访问运行它的硬件吗?
Windows doesn't check to see if your monitor actually measures to the DPI you configure it for, so just attach the biggest monitor you can and start switching the setting.
I'm curious to know why you want to test such high resolutions, i.e. anything over 192. If you have an actual need for such high resolution, surely you have access to the hardware that will be running it?