.NET 2.0 provides a
control that you can drag and drop directly into a
Windows application. This gives you a full-featured Internet Explorer 6
browser embedded in your application, with virtually no coding
You can drag a full featured Internet Explorer 6 browser directly in to your Windows application.
Create a new Windows application (
WebBrowsing) and enlarge the form to hold a
reasonably sized browser and a couple of other controls. Drag a
WebBrowser control onto your form. You'll notice that it fills the
form, but if you use its smart tag to click Undock in the parent
container, you'll find you have a resizable
WebBrowser control within the form.
Notice that loading the page is accomplished asynchronously--for example, your application keeps running while the page is loading.
URL property of the
WebBrowser control and type the URL of your favorite web site (for
example, http://www.LibertyAssociates.com). Run the
application and voila! You're browsing my site.
Let's add a few useful controls: a text box (with auto-complete for URLs), a progress bar, and Back and Forward buttons.
The browser control fires a number of useful events as the page is loading. Some of the most useful are shown in Table 3-6.
Table 3-6. Browser events
Raised when you set a new URL, or when the user clicks a link. (Use this to cancel navigation.)
Raised just before the web browser begins ...