-
Notifications
You must be signed in to change notification settings - Fork 55
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
put_ShouldDetectMonitorScaleChanges unable to block Windows DPI scale #3665
Comments
@menghuijinxi Could you tell us the repro steps, what's the expected outcome vs actual results? Also may you share informartion about the environment:
|
I think calling “controller3->put_ShouldDetectMonitorScaleChanges(FALSE)” should not have any scaling effects on WebView2 when switching Windows DPI Scale. However, in reality, even after calling this, switching Windows DPI Scale still affects WebView2 and causes scaling effects Framework:Win32 |
// code snippet
|
@menghuijinxi, can you be more specific about the scaling effects you are seeing? Calling ShouldDetectMonitorScaleChanges(FALSE) should prevent the WebView2 from changing the RasterizationScale property as a result of monitor DPI scale changes. It is the app's responsibility to update the RasterizationScale. But calling ShouldDetectMonitorScaleChanges(FALSE) does not change the scale of the WebView2. So if you created WebView2 on a monitor with a scale of 1.25, WebView2 would set the RasterizationScale to 1.25. Calling ShouldDetectMonitorScaleChanges(FALSE) will prevent future monitor scale changes from impacting RasterizationScale, but it does not change the WebView2 RasterizationScale back to 1.0. If you want WebView2 to render at 100%, you need to also call put_RasterizationScale(1.0). |
After your explanation, I understand the purpose of the ShouldDetectMonitorScaleChanges function, this function is not what I need. |
I now use “GetDpiForMonitor” to obtain the DPI of the Windows system, and then divide it by 96 to get the system’s scaling factor, assuming it is 1.25. Finally, by using 1/1.25=0.8 and invoking put_RasterizationScale(0.8), I can achieve the desired effect and solve this problem. |
I disable the impact of Windows DPI on webview2 through the following method:
The text was updated successfully, but these errors were encountered: