The application worked as expected up to version v107+. However, after upgrading from v108 to v119, the application did not work as expected. CefSharp with Chromium rendered the text too small.
Prior to Chromium v108:
Text displayed correctly within the application. Text size matched user expectations and system settings. After upgrading to Chromium v108 and later versions (up to v119):
Text rendered significantly smaller than expected. Text appears unreadable or difficult to read due to the reduced size.
Chromium rendered the text - responsive
To define a method or a variable, you need to follow this syntax:
Declare a method that takes an IntPtr parameter and returns a bool value
public static extern bool SetProcessDpiAwarenessContext(IntPtr dpiAwarenessContext);
Declare a variable that holds an int constant with the value -1
private const int DPI_AWARENESS_CONTEXT_UNAWARE = -1;
Before initializing, call this method:
if (!Cef.IsInitialized)
{
var r = SetProcessDpiAwarenessContext((System.IntPtr)DPI_AWARENESS_CONTEXT_UNAWARE);
if (!r)
{
var error = Marshal.GetLastWin32Error();
Trace.TraceWarning($@"Error settings DPI awareness: {error}.");
}
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
}
Reference Link:
https://github.com/cefsharp/CefSharp/issues/4410#issuecomment-1542363136