ZengCode.Com (The Thai Php Framework)  


Home   Download   Manual   About us    

Facebook   


MAIN MENU
News
Php Tips
Android Programming
Design Pattern By PHP
Spring+Strut+Hibernate
C# Tips & Technique
C# Design Pattern
Linux Quick Tips
C# using Linq น่าใช้จริงๆ
Java & JavaScript Tips
Database & SQL
ZengCode Framework Guide
Zeng Code Code
Programming
IPhone (Tips and Trick)

Download เอกสารที่น่าสนใจ

     Create a WebBrowser with C#  (2009-10-01)

You will need: 1 Toolstrip + ToolStrip Controls(explained later), 1 WebBrowser.

First thing is first, drag a toolstrip from the toolbox onto the form. Make sure that the Grip Visibility is set to Hidden.

IPB Image

Now we will add the controls. You will need:(6 ToolStripButtons, 1 ToolStripLabel, and 1 ToolStripTextBox). Now we will set the names of the controls. The first button will be called back, the second forward, the third refresh, the fourth stop, the fifth home and the last GO. For the GO button set the alignment property to right. Now that you have the names we can set each of the button's DisplayStyle to Image. Set the proper images for each button. Now we will name the label and the textbox on the toolstrip. For the Label set the text property to URL: and the name to urlLabel. Now the textbox will be named url and the text leave blank.


Next drag the WebBrowser Control onto the form.

IPB Image

Set the name property of the webbrowser to webBrowser

Now for the coding.

Double-Click on the Form and enter this code webBrowser.GoHome();.
Double-Click on the Back Button and enter this code webBrowser.GoBack();.
Double-Click on the Forward Button and enter this code webBrowser.GoForward();.
Double-Click on the Refresh Button and enter this code webBrowser.Refresh();.
Double-Click on the Stop Button and enter this code webBrowser.Stop();.
Double-Click on the Home Button and enter this code webBrowser.GoHome();.
Double-Click on the GO Button and enter this code webBrowser.Navigate(url.Text);.
Double-Click on the webBrowser and enter this code url.Text = e.Url.ToString();.

This is what your final design should look like.

IPB Image

Now run the form and have fun!


Comment
Name
Comment
Security CodeCAPTCHA Image

web hit counter

This page took 0.049906 seconds to load.