Git Product home page Git Product logo

Comments (2)

Nutzzz avatar Nutzzz commented on July 21, 2024

I've been working on this, so I figured I'd post an update.

First stumbling block: A method that gives me a usable scale or DPI for a command line program. I tried many possibilities, but I finally found one that worked for me: GetDpiForWindow() in user32.dll. Divide by 96, and you get the scaling percentage; though note this requires Windows 10 1607. The manifest need not be adjusted to change DPI_AWARENESS.

Now it's on to the second stumbling block: It seems the GDI surface needs to be resized as well somehow. Multiplying x, y, w, and h by the scaling factor moves the image out of the visible area. By multiplying just w and h, the problem becomes clear:

image

EDIT:
Just to be clear, having gdiScaling set to true and/or dpiAware set to true/pm and dpiAwareness set to PerMonitorV2,PerMonitor [in the manifest] doesn't change the observed behavior.

EDIT 2:
Hm, interesting. Going to the Compatibility tab for glc.exe and changing "Change high DPI settings" > "Override high DPI scaling behavior" to "Application" it working.

image

However, I'm having difficulty so far reproducing the equivalent behavior by changing the app.manifest, App.config, or programatically. I could force the compatibility registry setting, but I'd rather not resort to that except as a last resort.

from glc.

Nutzzz avatar Nutzzz commented on July 21, 2024

This did the trick:
SetProcessDpiAwarenessContext(GetAwarenessFromDpiAwarenessContext(GetThreadDpiAwarenessContext()) - 3); // DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE

EDIT: Fixed in PR #54

from glc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.