来源: 使用cefsharp 浏览器放大-布布扣-bubuko.com
(1)如果浏览器位置有问题,需要设置 Cef.EnableHighDPISupport();
(2)如果要放大浏览器,需要设置 browser.SetZoomLevel(1.25);
ChromiumWebBrowser webbrowser = new ChromiumWebBrowser(""); private void Form1_Load(object sender, EventArgs e) { Cef.EnableHighDPISupport(); this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; string url = System.Configuration.ConfigurationManager.AppSettings["url"]; webbrowser = new ChromiumWebBrowser(url); // Add it to the form and fill it to the form window. webbrowser.Dock = DockStyle.Fill; webbrowser.FrameLoadEnd += webbrowser_FrameLoadEnd; this.Controls.Add(webbrowser);
void webbrowser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e) {
ChromiumWebBrowser browser = (ChromiumWebBrowser)sender;
browser.SetZoomLevel(1.25);
}