Ways to open page pages in WinForm

Source: Internet
Author: User

1, first relatively simple we know that there are similar methods as follows

System . Diagnostics . Process . Start ("http://www.baidu.com");

2, more flexible, you can define the window size, we want to implement the Web page script to open the page method, that is window.open

So, we are bound to think, how to invoke the script of the page? Can actually use WebBrowser to realize

//Connection stringURL="Http://www.baidu.com"; //define Scripts stringScript=@"<script language= ' javascript ' type= ' Text/javascript ' > function OpenUrl (URL) { window.open (URL, ' Test window ', ' width=400px,height=400px,directories=true,location=false,menubar=false,resizeable= False,scrollbars=yes,toolbar=false '); }</script> "; WebBrowserWB=NewWebBrowser(); WB.DocumentText=@"+Script+";//define DOM documents in WebBrowser WB.documentcompleted+=Delegate { //Execute script function WB.Document.Invokescript("OpenUrl",NewObject[]{URL}); };

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.