C#winform replacing the Webbowser control with the chrome kernel

Source: Internet
Author: User

Summary

Due to the recent need to do a browser-style software, there are many places to use jquery and Bootstrap, but in C #, the default WebBrowser control is the default use of IE core, and the low version of IE in JS loading is always prone to problems, so, Plan to replace IE with Chrome's kernel.

Preparatory work

First of all, you have to understand that the chrome kernel is not called chrome, but WebKit, so we just have to find the WebKit project.

1. Download the WebKit Project bin with the following URL:

Https://sourceforge.net/projects/webkitdotnet/files/WebKit%20.NET%200.x/0.5/WebKit.NET-0.5-bin-cairo.zip/download.

2. Download the extracted directory structure as follows:

  

3. Put everything under the bin folder (yes!). is all files copied) and pasted into the project folder, the target directory is: project name/bin/debug/

  

4. Import the Webkitbrowser DLL into your project. The operation in VS2015 is as follows (other analogy):

Under Solution Explorer, select your project name, then right-click Add, then select Reference, such as:

  

5. In the dialog box that pops up. Choose Browse, browse ..., and then select your: project name/bin/debug before pasting the WebKitBrowser.dll import, the results are as follows:

  

Coding phase

1. You have to do, first select the bin directory you downloaded before the WebKitBrowser.dll, and then copy, such as:

  

2. In the control bar of C #, build yourself a custom C # control bar, such as my call WebBrowser, and then paste the dll you just copied in the toolbar, with the final effect as:

  

You can then use the Webkitbrowser control normally.

3. The browser's kernel can be tested via this website, url: http://ie.icoa.cn/

As for the running code, the following is given:

1 private void Form1_Load (object sender, EventArgs e) 2 {3     webkitbrowser1.navigate ("http://ie.icoa.cn/"); 4}

Here are the pre-and post-configuration comparisons:

Before configuration:

  

After configuration:

  

Thanks

Thanks to the s_p comments, and if you want to make a release version instead of debug, your directory should be: project name/bin/release.

Add

Thanks to the park friend's point, webkitbrowser this project has not been maintained, with. NET version of the promotion, is also likely to have problems, so the recommendation of another more useful cefsharp, the specific process and webkitbrowser basically consistent.

If a friend wants to use Cefsharp, welcome to view this article, speak very detailed, from Codeceo: Portal here:)

C#winform replacing the Webbowser control with the chrome kernel

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.