VB2015 Designer文本/显示缩放

时间:2016-07-31 06:39:18

标签: winforms visual-studio visual-studio-2015 dpi

我有一个Win Forms应用程序,我在笔记本电脑或台式机上工作。 (没有什么特别的软件,我的工作似乎无关紧要)

台式机和笔记本电脑上的两个显示器都有不同的文本缩放选项。

在一台计算机上,项目布局(文本框,标签等的位置)很好,但是!如果你打开另一个项目,一切都会移动,布局(/我的GUI)最终完全毁了。如果您构建/保存此项目,那么所有项目都将丢失,所有这些都必须重置/重新定位以适合您正在构建它的计算机。实际构建项目后,应用程序运行/看起来很好。 (在任何屏幕/ res / dpi刻度上)(编辑:如果构建版本的布局正确,则内置版本可以正常使用)

似乎VS的设计师在处理表单时无法处理DPI规模变化。

有谁知道这个解决方案?我已经在几个控件/表单上更改了DPI缩放模式,似乎没有任何效果。它只是一个Visual Studio Bug ???

感谢interwebs。

编辑:确定这是一个转折:如果您打开项目时屏幕文本缩放设置与上次保存项目的计算机相同,那么(使用VS打开)更改文本缩放,控件正确移动,一切都很好。 (东西应该在哪里)......

1 个答案:

答案 0 :(得分:0)

您现在可能已经解决了这个问题,但是......您是否尝试过为Visual Studio创建外部清单文件?

此处描述了流程:http://www.danantonielli.com/adobe-app-scaling-on-high-dpi-displays-fix/我完全复制了Antonielli的photoshop清单文件,似乎工作正常,这并不意味着我理解它。我将在下面显示,以防有知识的人可以纠正任何错误。

现在试过这个,但它似乎对我有用。我正在将Windows窗体应用程序开发从1920x1080笔记本电脑移动到2560x1440笔记本电脑,我的应用程序在运行时可以很好地扩展,但是VS2015屏幕是不可读的。所以,你在设计中看到的是一团糟,而不是你运行应用程序时得到的东西。

我的应用程序只是在所有表单上将AUTOSCALEMODE设置为INHERIT,然后在主窗体上将AUTOSCALEMODE设置为FONT。这里的各种帖子讨论了我确定的更好的方法(例如,Creating a DPI-Aware ApplicationHow to control the font DPI in .NET WinForms app)。

以下是Antonielli的photoshop清单文件(必须首先按照上面的博客链接更改注册表),该文件保存在我的计算机上作为" C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ devenv.exe.manifest":

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

 <dependency>
   <dependentAssembly>
     <assemblyIdentity
       type="win32"
       name="Microsoft.Windows.Common-Controls"
       version="6.0.0.0" processorArchitecture="*"
       publicKeyToken="6595b64144ccf1df"
       language="*">
     </assemblyIdentity>
   </dependentAssembly>
 </dependency>

 <dependency>
   <dependentAssembly>
     <assemblyIdentity
       type="win32"
       name="Microsoft.VC90.CRT"
       version="9.0.21022.8"
       processorArchitecture="amd64"
       publicKeyToken="1fc8b3b9a1e18e3b">
     </assemblyIdentity>
   </dependentAssembly>
 </dependency>

 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
   <security>
     <requestedPrivileges>
       <requestedExecutionLevel
         level="asInvoker"
         uiAccess="false"/>
     </requestedPrivileges>
   </security>
 </trustInfo>

 <asmv3:application>
   <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
     <ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</ms_windowsSettings:dpiAware>
   </asmv3:windowsSettings>
 </asmv3:application>

 </assembly>
相关问题