使用cefsharp 浏览器放大

(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);

                   }

 

上一篇:cefsharp插入自定义JS


下一篇:利用C# CefSharp Python采集某网站简历并自动发送邀请短信