简体   繁体   中英

Application displays correctly on a 150% scaled monitor but not on a 100% one

I am currently developing an application in c# with .NET Framework 4.7 I have a problem with DPI scaling. On my computer I have two monitors, one with 150% scaling and another one with 100%. I added this code in my app manifest file:

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

And it works perfectly fine.

正确显示后的外观

i take the exe file and all its dependecies, take it to another computer who as only one screen with 100% scaling and the application doesn't look as it should do.

未正确显示时的外观

I hope you guys have a solution for me I am struggling since two days with this problem...

Well, like every time I post my problem I figure out the solution a few moments later.

I removed the manifest file from the application and changed the AutoScaleMode propertie to Dpi instead of Font for every form in my application.

And now it works like a charm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM