soukoku / ntwain

A TWAIN lib for dotnet.
MIT License
119 stars 50 forks source link

Display scaling issues #17

Closed darko1979 closed 4 years ago

darko1979 commented 4 years ago

I'm on Windows 10 and when display scaling is active executing following lines resets display scaling to 100% for current application.

            var appId = TWIdentity.CreateFromAssembly(DataGroups.Image, Assembly.GetExecutingAssembly());
            var session = new TwainSession(appId);
            session.Open();

Did anybody else encounter this issue and found a solution?

soukoku commented 4 years ago

You can try to declare the app as high DPI aware by putting these in an app manifest file like below. You may have to use other values depending on whether it actually supports high DPI (see the docs).

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
    </windowsSettings>
  </application>
darko1979 commented 4 years ago

Thanks, it worked.