Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Reflection;
namespace WebBrowserNamespace
{
/// <summary>
/// Summary description for WinForm3.
/// </summary>
public class WebBrowserForm : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox URL;
protected Object oMissing = System.Reflection.Missing.Value;
private AxSHDocVw.AxWebBrowser WebBrowser;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private WinForm2 internetoptions = new WinForm2();
private System.Windows.Forms.RichTextBox homepage;
private System.Windows.Forms.Label status;
private System.Windows.Forms.Button Go;
private WinForm3 about = new WinForm3();
private System.Windows.Forms.ProgressBar ProgressBar1;
public WebBrowserForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(WebBrowserForm));
this.label1 = new System.Windows.Forms.Label();
this.WebBrowser = new AxSHDocVw.AxWebBrowser();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.URL = new System.Windows.Forms.TextBox();
this.homepage = new System.Windows.Forms.RichTextBox();
this.status = new System.Windows.Forms.Label();
this.Go = new System.Windows.Forms.Button();
this.ProgressBar1 = new System.Windows.Forms.ProgressBar();
((System.ComponentModel.ISupportInitialize)(this.WebBrowser)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(312, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 24);
this.label1.TabIndex = 0;
this.label1.Text = "Address";
//
// WebBrowser
//
this.WebBrowser.Anchor = System.Windows.Forms.AnchorStyles.None;
this.WebBrowser.Enabled = true;
this.WebBrowser.Location = new System.Drawing.Point(-8, 72);
this.WebBrowser.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("WebBrowser.OcxState")));
this.WebBrowser.Size = new System.Drawing.Size(1288, 784);
this.WebBrowser.TabIndex = 5;
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2,
this.menuItem3});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "File";
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem4});
this.menuItem2.Text = "Options";
//
// menuItem4
//
this.menuItem4.Index = 0;
this.menuItem4.Text = "Internet Settings";
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
//
// menuItem3
//
this.menuItem3.Index = 2;
this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem5});
this.menuItem3.Text = "Help";
//
// menuItem5
//
this.menuItem5.Index = 0;
this.menuItem5.Text = "About";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.RoyalBlue;
this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));
this.button1.Location = new System.Drawing.Point(8, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 56);
this.button1.TabIndex = 6;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.RoyalBlue;
this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
this.button2.Location = new System.Drawing.Point(96, 8);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 56);
this.button2.TabIndex = 7;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.BackColor = System.Drawing.Color.RoyalBlue;
this.button3.Image = ((System.Drawing.Image)(resources.GetObject("button3.Image")));
this.button3.Location = new System.Drawing.Point(184, 8);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(80, 56);
this.button3.TabIndex = 8;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.BackColor = System.Drawing.Color.RoyalBlue;
this.button4.Image = ((System.Drawing.Image)(resources.GetObject("button4.Image")));
this.button4.Location = new System.Drawing.Point(272, 8);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(32, 24);
this.button4.TabIndex = 9;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.BackColor = System.Drawing.Color.RoyalBlue;
this.button5.Image = ((System.Drawing.Image)(resources.GetObject("button5.Image")));
this.button5.Location = new System.Drawing.Point(272, 40);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(32, 24);
this.button5.TabIndex = 10;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// URL
//
this.URL.Location = new System.Drawing.Point(392, 40);
this.URL.Name = "URL";
this.URL.Size = new System.Drawing.Size(768, 22);
this.URL.TabIndex = 11;
this.URL.Text = "";
//
// homepage
//
this.homepage.Location = new System.Drawing.Point(1264, 8);
this.homepage.Name = "homepage";
this.homepage.Size = new System.Drawing.Size(8, 24);
this.homepage.TabIndex = 12;
this.homepage.Text = "";
this.homepage.Visible = false;
//
// status
//
this.status.BackColor = System.Drawing.Color.DarkGreen;
this.status.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.854546F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.status.Location = new System.Drawing.Point(8, 856);
this.status.Name = "status";
this.status.Size = new System.Drawing.Size(100, 16);
this.status.TabIndex = 13;
this.status.Text = "label2";
//
// Go
//
this.Go.BackColor = System.Drawing.Color.RoyalBlue;
this.Go.Location = new System.Drawing.Point(1168, 40);
this.Go.Name = "Go";
this.Go.Size = new System.Drawing.Size(96, 23);
this.Go.TabIndex = 14;
this.Go.Text = "Go";
this.Go.Click += new System.EventHandler(this.Go_Click);
//
// ProgressBar1
//
this.ProgressBar1.Location = new System.Drawing.Point(1160, 864);
this.ProgressBar1.Name = "ProgressBar1";
this.ProgressBar1.Size = new System.Drawing.Size(100, 8);
this.ProgressBar1.TabIndex = 15;
//
// WebBrowserForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.BackColor = System.Drawing.Color.DarkGreen;
this.ClientSize = new System.Drawing.Size(1272, 871);
this.Controls.Add(this.ProgressBar1);
this.Controls.Add(this.Go);
this.Controls.Add(this.status);
this.Controls.Add(this.homepage);
this.Controls.Add(this.URL);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.WebBrowser);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Menu = this.mainMenu1;
this.Name = "WebBrowserForm";
this.Text = "Ka Explorer";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.WinForm3_Load);
((System.ComponentModel.ISupportInitialize)(this.WebBrowser)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new WebBrowserForm());
}
private void LoadPage()
{
string WebURL = URL.Text;
WebBrowser.Navigate(URL.Text, ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
}
private void btnViewWebPage_Click(object sender, System.EventArgs e)
{
LoadPage();
}
private void WinForm3_Load(object sender, System.EventArgs e)
{
LoadPage();
homepage.LoadFile("homepage.rtf");
homepage.Hide();
URL.Text = homepage.Text;
WebBrowser.Navigate(URL.Text, ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
ProgressBar1.Hide();
}
private void WebBrowser_Navigated(object sender, AxSHDocVw.AxWebBrowser e)
{
ProgressBar1.Visible = true;
URL.Text = WebBrowser.LocationURL;
}
private void button2_Click(object sender, System.EventArgs e)
{
WebBrowser.Refresh();
}
private void button3_Click(object sender, System.EventArgs e)
{
WebBrowser.Stop();
}
private void button5_Click(object sender, System.EventArgs e)
{
WebBrowser.GoBack();
}
private void button4_Click(object sender, System.EventArgs e)
{
WebBrowser.GoForward();
}
private void button1_Click(object sender, System.EventArgs e)
{
LoadPage();
homepage.LoadFile("homepage.rtf");
homepage.Hide();
URL.Text = homepage.Text;
WebBrowser.Navigate(URL.Text, ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
}
private void menuItem4_Click(object sender, System.EventArgs e)
{
internetoptions.Show();
}
private void menuItem5_Click(object sender, System.EventArgs e)
{
about.Show();
}
private void Go_Click(object sender, System.EventArgs e)
{
LoadPage();
}
private void WebBrowser_ProgressChanged(object seneder, System.EventArgs e)
{
}
}
}
I've pasted my whole code, because i don't know what you mean by the api documentation.