Friday, October 8, 2010

Open HTML Pages With the Webbrowser Control

In C# there is a command, with which websites can be displayed as in a browser. The control is called WebBrowser and is included in the toolbox by default.
If you place it on the form, it will probably stretch over all its width, if this is not desired change the property Dock.
That how part of this blog looks like in the WebBrowser:



Now I want to describe some functions of this control::

Navigate(): This is probably the most important function, with it pages can opened in the WebBrowser control. It expects a string as argument, which is the garget URL.

GoHome(): Navigates to the home page of the current user.

GoSearch(): Navigates to the page of the standard search engine of the current user.

Print(): Prints the page currently being displayed using the current printer settings of the system.

ShowPrintDialog(): Opens the dialog "Print" of the Internet Explorer, to print the current page.

ShowSaveAsDialog(): Opens the dialog "Save", to save the current page as a HTML document.

No comments:

Post a Comment