使用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);

                   }

 

posted @ 2019-03-13 12:30  启明星工作室  阅读(1343)  评论(0编辑  收藏  举报