使vb.net应用程序DPI知道 [英] Make vb.net application DPI aware

查看:146
本文介绍了使vb.net应用程序DPI知道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在任何DPI设置上使我的vb.net应用程序正确缩放。目前,如果设置不是标准设置,它就会变得混乱。

I need to make my vb.net app scale up properly on any DPI setting. Currently it gets messed up if the setting is anything other than standard.

我发现的所有内容都是C#或旧版本的VB或Visual Studio Pro的引用,而不是兼容我使用的版本。

Everything i found refers either to c# or to older versions of VB or to Visual Studio Pro and are not compatible to the version I am using.

我在Visual Studio Express 2013上。

I am on Visual studio express 2013.

谢谢

推荐答案

来自文章在大型DPI设置下WinForms缩放-甚至可能吗?在Telerik网页上

Taken from the article WinForms scaling at large DPI settings – is it even possible? on the Telerik web page

在清单文件中声明DPI感知。

您可以使用以下标记来设置dpiAware标志。可能的值对于DPI感知应用为True,对于非DPI感知应用为False,对于每个监视器DPI感知应用为True / PM。

Declaring the DPI awareness is done in a manifest file.
You can use the following markup to set the dpiAware flag. Possible values are True for DPI-aware app, False for non-DPI-aware app and True/PM for per-monitor-DPI-aware app.

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
   <asmv3:application>
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
             <dpiAware>true</dpiAware>
        </asmv3:windowsSettings>
   </asmv3:application>
</assembly>

WinForms平台具有其自己的缩放机制,该机制可以计算出表单已被使用的系统之间的缩放差异。设计并在其上运行的系统。然后,它根据计算出的系数修改所有控件的大小和位置。请注意,只有在您的应用程序声明支持DPI时,才会触发这种缩放,否则它将在96 DPI沙箱中呈现,并且将使用操作系统的位图缩放。

The WinForms platform has its own scaling mechanism which calculates the scaling difference between the system that the form has been designed on and the system it is running on. Then it modifies the size and the location of all controls according to the calculated factor. Note that this scaling will only trigger if your application declares to be DPI-aware, otherwise it will be rendered in the 96 DPI sandbox and the bitmap scaling of the OS will be used.

这篇关于使vb.net应用程序DPI知道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆