-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc - High-DPI support is now enabled by default in Chromium #4410
Comments
- Remove DPI entries from app.manifest - Remove Cef.EnableHighDPISupport (Method will be removed in M113 (cefsharp/CefSharp#4417)) Issue cefsharp/CefSharp#4410
For |
M111 will be the first version to rely on the |
I want to continue using CefSharp in a WinForms app that is currently not yet capable of running in High-DPI mode. Is there still a way to fall back to non-High-DPI mode? Update 1It seems that disabling High-DPI through the application manifest did not help. Instead, I removed all High-DPI related stuff from the manifest and instead did call the following right at the beginning of my application: SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE); So far, it seems that this works. (Context: I'm using CefSharp as "self-hosted" in a .NET 7 WinForms application, 64-bit) |
I cannot seem to find this SetProcessDpiAwarenessContext method, do you know where this is? As I also need this. |
@Yokomoko Sure, it is P/Invoke: [DllImport(@"user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetProcessDpiAwarenessContext(IntPtr dpiAWarenessContext);
private const int DPI_AWARENESS_CONTEXT_UNAWARE = -1;
private const int DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED = -5; My call then looks like: var r = SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
if (!r)
{
var error = Marshal.GetLastWin32Error();
Trace.TraceWarning($@"Error settings DPI awareness: {error}.");
} |
There is a bitmap scaling that is used by Terminal Server and newer Windows versions for non-DPI aware (manifest not modified) application. Chromium instance is overriding that function by re-rendering the application (including windows that doesn't contain an embedded browser) causing it to resize and remove bitmap scaling. |
You can override this behaviour as
There are some additional examples of setting |
In the context of WinForms. Setting See https://learn.microsoft.com/en-us/dotnet/desktop/winforms/wfdev-diagnostics/wfac010?view=netdesktop-8.0 for Microsoft guidance regarding the compiler warning that will be raised. Starting in Application.SetHighDpiMode(HighDpiMode.DpiUnaware);
Application.SetHighDpiMode(HighDpiMode.DpiUnawareGdiScaled);
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.SetHighDpiMode(HighDpiMode.PerMonitor);
Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); |
Starting in
M108
High-DPI support is now enabled by default in Chromium.chromiumembedded/cef#3452
The text was updated successfully, but these errors were encountered: