Some ways to use web page controls in a WinForm form

Source: Internet
Author: User

Recently get a project, is a CS. Of course, there are forms and the like, if you move the HTML form on the form is much more convenient.

. First, you use a control

WebBrowser

The load page does not use the URL attribute, which uses the following attribute

This.webBrowser1.DocumentText = html;

Because the HTML form page is set to "embedded resources", use the class that accesses the resource, read the HTML page, and then become a string.

What if I want to refer to jquery and style files?

The compressed source of JQ has been copied to the page, the result is can be used, but it takes a few minutes to copy. Obviously, this is not the way to do it.

.1) Pre-written reference script in HTML page <script src= "$jquerypath placeholder" ></script>

.2) Jquery.js This file property is set to "Always copy"

.3) Then figure out the path to jquery in the program is probably this string jquerypath = Application.StartupPath.Replace (@ "\", "/") + "/jquery.js";

Finally, the path is replaced with the src dot. The result is valid and can be referenced.

: This method achieves the requirement, but feels very not advanced, helpless did not find the more scientific method. Let's solve the problem first.

Some ways to use web page controls in a WinForm form

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.