使用cefsharp 瀏覽器放大

(1)若是瀏覽器位置有問題,須要設置 Cef.EnableHighDPISupport();web

(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)         {this

            ChromiumWebBrowser browser = (ChromiumWebBrowser)sender;url

            browser.SetZoomLevel(1.25);code

                   }orm

相關文章
相關標籤/搜索