"Go" C # development Chrome kernel browser (webkit.net)

Source: Internet
Author: User

Webkit.net is a. NET package for WebKit, which uses. NET programs to integrate and use WebKit easily as a container for loading web pages. Here's how to use it to display one of the simplest features of a Web page.

The first step:

Download the bin file for webkit.net. Do not underestimate this step, you may not be able to download the success, the reason you understand.

Webkit.net's homepage is http://webkitdotnet.sourceforge.net/

Download the 0.5 version of the Windows bin file directly with the address: https://sourceforge.net/projects/webkitdotnet/files/WebKit%20.NET%200.x/0.5/ Webkit.net-0.5-bin-cairo.zip/download

Step Two:

Create a new WindowsForms project.

Then copy all the files in the downloaded Webkit.net bin directory to the bin/debug/directory of the new project.

Add a reference and browse to add a reference to "WebKitBrowser.dll".

Step Three:

To write the code. Double-click the Form1 form to enter the code and write down these lines of code:

private void Form1_Load (object sender, EventArgs e)        {            Webkit.webkitbrowser browser = new Webkitbrowser ();            Browser. Dock = DockStyle.Fill;            This. Controls.Add (browser);            Browser. Navigate ("http://www.lixin.me");        }

Run to see the effect:

WebBrowser vs. IE Kernel:

It's a very simple three-step. But then again, nowadays it is popular one step, such as using System.Windows.Forms.WebBrowser.

Use. NET Framework, it may be easier to invoke the webbrowser of the IE kernel to display the Web page, simply by writing a few lines of code in the new project:

  private void Form1_Load (object sender, EventArgs e)        {            WebBrowser browser = new WebBrowser ();            Browser. Dock = DockStyle.Fill;            This. Controls.Add (browser);            Browser. Navigate ("http://www.lixin.me");           }

The effect looks pretty much the same, the naked eye can only see a slightly different font:

Since all the same, why bother to download a few m DLL to display the page? This is because if the use of IE kernel webbrowser we can not predict the effect of the page display, such as your computer is XP, may call IE6 as the loader, if it is Win7, may call IE8 as the loader, and their display effect is not exactly the same. Let's take a look at the following example.

Http://css3.zxq.net/doraemon/doraemon_css3.html This page is used to test the extent to which the browser supports CSS3. Now we're going to show this page in 2 different ways.

private void Form1_Load (object sender, EventArgs e)        {            WebBrowser browser = new WebBrowser ();            Browser. Dock = DockStyle.Fill;            Browser. Navigate ("http://css3.zxq.net/doraemon/doraemon_css3.html");            SPLITCONTAINER1.PANEL1.CONTROLS.ADD (browser);            Webkit.webkitbrowser kitbrowser = new Webkitbrowser ();            Kitbrowser.dock = DockStyle.Fill;            Kitbrowser.navigate ("http://css3.zxq.net/doraemon/doraemon_css3.html");            SPLITCONTAINER1.PANEL2.CONTROLS.ADD (Kitbrowser);        }

As follows:

The native system is WIN7+IE9, but through WebBrowser calls, it is estimated that the IE8 kernel is still in use, so the display effect is poor.

By this contrast, you can see that one more step of trouble, is necessary.

From:http://www.cnblogs.com/linyijia/p/4045333.html

"Go" C # development Chrome kernel browser (webkit.net)

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.