在高dpi设置上禁用显示比例缩放

在高dpi设置上禁用显示比例缩放

本文介绍了如何以编程方式激活“在高dpi设置上禁用显示比例缩放"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio 2010上使用C#开发Windows窗体应用程序.我发现如果使用高dpi显示设置,此应用程序将被缩放.但是,如果我通过在Windows资源管理器上单击鼠标右键菜单来激活文件属性在高dpi设置上禁用显示缩放",则似乎无法缩放.

I am developing Windows form application using C# on Visual Studio 2010.I found that this application is scaled if I used high dpi display setting.But if I activate file property "disable display scaling on high dpi settings" by mouse right click menu on windows explorer, it seems that it is not scaled.

是否可以在Visual Studion 2010 C#或更高版本上以编程方式激活在高dpi设置上禁用显示缩放"?

Is there a way to activate "disable display scaling on high dpi settings" programatically on Visual Studion 2010 C# or upper version ?

我尝试设置应用程序清单文件,但尚未成功设置.

I tried to set application manifest file but not set it up successfully yet.

推荐答案

使用清单文件(在Visual C#项目下为app.manifest)为我解决了此问题.例如:

Using manifest file (app.manifest under Visual C# project) resolved this issue for me. For example:

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

这当然应该在您的主要程序集"部分中.

Of course this should be inside your main "assembly" section.

P.S.我在调试GitExtensions时验证了这一点.

P.S. I verified this when debugging GitExtensions.

P.P.S.我了解这个问题很旧,但是可能有人仍然需要该信息.

P.P.S. I understand that the question is old, but may be someone still needs the info.

更新:但是,这可能导致Windows窗体上的组件自动发生不必要的大小调整.

Update: however it may lead to automatical undesired resizing of components on the windows form.

这篇关于如何以编程方式激活“在高dpi设置上禁用显示比例缩放"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 02:24