C # Winform use CefSharp will WebBowser control is replaced with Chrome kernel

     Nonsense first paragraph, for a long time did not write a blog, but also with the environment, work-related, before making techniques, Park turned over the daily blog (or blog like the park, because we all share exchange selfless ah, what things will be like CSDN points, contempt of), now occasionally need a something to write about and we have to open VS, just come on, see the previous concerns of friends and adhere to write a blog, also occasionally under mood before recording the idea, now that there is no interest, 7 in a changed man, it seems, return to the topic ~

 

       The company participated in an exhibition information, need a few sites similar system as PPT carousel to show up at a screen, not find a solution, then I tried to who won this task, the first thought of using webbrowser winform, try the next no problem can be achieved, but some sites need to load the system and other controls such as Ali, webbrowser IE is supported by the kernel, the system needs a lot of support chorme, then find a way online, first find the WebKit.NET this control, add into it, but Ali was loaded out of control, the first day to give up, and today nothing else, think again try to continue to Baidu, the search to a technical posted: http://www.codeceo.com/article/ App---in CHARP cefsharp for chrome.html  (turned rural network code), which refers to this CefSharp:

        CefSharp reliable, fast, fully open source, without any additional dependencies can be installed to the end user (other than VC ++ Runtime 2013). CefSharp also be working on WPF project.

      CefSharp v51 x86 (32位)  https://raw.githubusercontent.com/hgupta9/CefsharpSite/gh-pages/files/CefSharp51_x32.zip

    CefSharp v51 x64(64位)    https://raw.githubusercontent.com/hgupta9/CefsharpSite/gh-pages/files/CefSharp51_x64.zip

 

      I did not use NuGet installation, direct download, it is recommended to unpack all the files directly pasted into the Debug directory, and then through a project reference - add a reference, the reference to the red box three dll file to the project,

C # Winform use CefSharp will WebBowser control is replaced with Chrome kernel

      You need to reference the .cs and Designer.cs page set of header files add two lines of code: 

       CefSharp the using;
       the using CefSharp.WinForms;
       design drag webbrowser control panel, or the current control winform case comes, the need to change the code Designer.cs:
       // Private the System.Windows.Forms.WebBrowser webBrowser1;

        private ChromiumWebBrowser webBrowser1;

        The first line of code generated by default into the second row, this time the statement is CefSharp.WinForms of webbrowser control

        this.webBrowser1 = new ChromiumWebBrowser("www.baidu.com");

 

        At this point, the case is not being given the run F6 F5 should be able to see the Baidu page.

        。。。

        。。。

           ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ The following is the key ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓  

       However, VS my error, I use VS2010, .NETFramework4.5 suggesting should be the wrong version, ChromiumWebBrowser no reference set, but it is CefSharp have been added to the project, and cited the success, and then continue Baidu: HTTPS: / /www.cnblogs.com/Leo_wl/p/6239233.html#_label1 (or blog Park niubility), see this post in a way:

        So only through 工具-程序包管理器-程序包管理控制台a manual command-line import version v49.0.1, enter the command Install-Package CefSharp.WinForms -Version 49.0.1Enter awaiting execution is completed.

      I try to execute it, then prompts to install successfully, F6 a bit, actually compile, there is no error, the procedure and should be returned to the V49 version (I went to Baidu CefSharp Download low version, there is no official online version provides low response package, so this way possible), then I need to Ali controls page can also be successfully load the control display properly, you're done -

 

      The code is not posted, mainly I want to quote a solution after being given CefSharp.dll VS were recorded, compared to WebKit.NET of more than 30 M, CefSharp resource pack bigger finished unpacked 100 + M, and if there the same demand for a friend can refer to the two controls. 

 

Source: http://blog.sina.com.cn/s/blog_5673e0ab0102y2lb.html

Guess you like

Origin www.cnblogs.com/mq0036/p/11059644.html