Search code examples
delphichromium-embedded

Chromium Embedded: How to scale a website to account for higher DPI (CEF3)


I use CEF3 for displaying a web page in my Windows application. It works fine, but it doesn't scale if Windows has higher DPI settings (e.g. 150%). I don't expect it to do this automatically but I also don't find any property which can be set to tell chromium to scale. Is there any way to do that?


Solution

  • Zoom and scale are different things as you already noticed. I think this is the formula you are looking for:

        public void SetScaleFactor(double scale)
        {
            double zoomLevel = Math.Log(scale, 1.2);
            this._browserHost.SetZoomLevel(zoomLevel);
        }
    

    You can give it a try and see the difference with zoom.

    Good luck!