縮放比例問題
CefSharp第一個坑:在高分辨率電腦上,顯示比例非100%,比如125%或200%時,有兩個異常:控件邊緣出現空隙,不能完全填充;按鍵等交互控件無法點擊,有偏移。
125%的效果:
100%的效果:
解決方案
(1)手動將系統顯示比例調整回100%。也可通過程序配置來完成:添加應用程序清單文件(app.manifest)
<application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> </windowsSettings> </application>
(2)使用CEF自帶的方法:
Cef.EnableHighDPISupport();
參考
https://www.cnblogs.com/guolixiucai/p/7081975.html
https://github.com/cefsharp/CefSharp/blob/master/CefSharp.WinForms.Example/Program.cs