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