Sumafu
Sumafu

Reputation: 189

Delphi TWebBrowser window.devicePixelRatio property

in our app we use the TWebBrowser component of Delphi to display web content. Now we have a problem if windows has scaled monitors, for example 125% scale. In this case some HTML-controls aren't rendert correctly, because the window.devicePixelRatio property in JavaScript isn't updated but stays on 1, althougt it should be 1.25 on a 125% scaled monitor.

Is there any posibillity to fix this issue? From inside JavaScript it is not possible to changes this value, but maybe from the Delphi side?

Edit: I tried out an embedded chromium and there it works fine. But currently it is not possible to move from ie to chromium.

A sample HTML:

<!DOCTYPE html>
<html>
    <body>
        <div style="width: 100px; height: 25px; border: 1px solid black; border-radius: 4px; overflow: hidden">
            <span style="font-size:10pt; white-space: pre">Long sample text</span>
        </div>
    </body>
</html>

In Embedded IE the text ist cut of

Upvotes: 3

Views: 534

Answers (1)

whosrdaddy
whosrdaddy

Reputation: 11860

Even though it is obsolete, you will find that enabling FEATURE_96DPI_PIXEL for your application will return the correct pixelratio:

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
   SOFTWARE
      Microsoft
         Internet Explorer
            Main
               FeatureControl
                  FEATURE_96DPI_PIXEL
                     yourapplication.exe = (DWORD) 00000001

The recommended way is to enable the DOCHOSTUIFLAG_DPI_AWARE flag.

Upvotes: 3

Related Questions