VS2015 Windows窗体DPI和屏幕分辨率问题 [英] Issue with VS2015 Windows Form DPI and Screen Resolution
问题描述
我有一个带有Windows窗体的VS2015项目,其中AutoScaleMode设置为DPI。 我们遇到了屏幕分辨率为1366x768的笔记本电脑用户的问题。屏幕为空白,他们必须将其拉伸以查看屏幕上
的信息。
I have a VS2015 project with a windows form that has AutoScaleMode set to DPI. We are encountering issues with laptop users who have a screen resolution of 1366x768. The screen is blank and they have to stretch it to see the information on the screen.
是 这个以编程方式有任何解决方案吗?我认为DPI模式应该根据屏幕分辨率进行缩放。
Is there any solution to this programmatically? I thought DPI mode was supposed to scale it based on the screen resolution.
谢谢。
推荐答案
   
你好J-Bal,
我使用Windows Forms对DPI-Aware做了以下两件事。
(1)在Designer视图中,[AutoScaleMode] - [Dpi]
  (当然,我们可以用代码编写)
(2)添加一个新文件"app.manifest"并在其中制作DPI-Aware:
  菜单[项目]> [添加新项目]> [应用清单文件] - [添加]
  修改这样的XML描述(即删除评论,取消注释):
Hi J-Bal,
I do the following two things for DPI-Aware with Windows Forms.
(1) in Designer view, [AutoScaleMode] - [Dpi]
(of course, we can write it in code)
(2) add a new file "app.manifest" and make DPI-Aware in it:
menu [Project] > [Add New Item] > [Application Manifest File]--[Add]
modify XML description like this (i.e. remove comment, make uncommented):
<!-- DIP-Aware -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
[个人评论]
我有一些:分辨率和DPI,1366 x 768(DPI 100%),1920 x 1080 (100%),2560 x 1440(125%)和3840 x 2160(125%)。
我注意到上面几乎是完美的,即不是100%好。需要进行一些调整才能获得良好的视图,例如:字体大小,控件之间的距离。
问候,
[personal comment]
I have some: resolution and DPI, 1366 x 768 (DPI 100%), 1920 x 1080 (100%), 2560 x 1440 (125%), and 3840 x 2160 (125%).
I got noticed the above is nearly perfect, i.e. not 100% good. Some adjustments are required for getting a good view, e.g. Font size, distance between Controls.
Regards,
这篇关于VS2015 Windows窗体DPI和屏幕分辨率问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!