Simple WebBrowser : Web Browser « GUI Windows Form « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » GUI Windows Form » Web BrowserScreenshots 
Simple WebBrowser

/*
Professional Windows GUI Programming Using C#
by Jay Glynn, Csaba Torok, Richard Conway, Wahid Choudhury, 
   Zach Greenvoss, Shripad Kulkarni, Neil Whitlow

Publisher: Peer Information
ISBN: 1861007663
*/

using System;
using System.Windows.Forms;
using System.Drawing;
using AxSHDocVw;

public class WebBrowser : Form
{
   private AxWebBrowser browser;
   private Button goButton;
   private TextBox addressBox;
   private Panel panel1;
   private Panel panel2;

   public WebBrowser()
   {
      panel1 = new Panel();
      panel2 = new Panel();
      browser = new AxWebBrowser();
      browser.BeginInit();

      this.SuspendLayout();
      panel1.SuspendLayout();
      panel2.SuspendLayout();

      this.Text = "MyWebBrowser";
      panel1.Size = new Size(30030);
      panel1.Dock = DockStyle.Top;

      panel2.Size = new Size(285,240);
      panel2.Location = new Point(531);
      panel2.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;

      browser.Dock = DockStyle.Fill;

      addressBox = new TextBox();
      addressBox.Size = new Size(26020);
      addressBox.Location = new Point(5,5);
      addressBox.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left;

      goButton = new Button();
      goButton.Image = Image.FromFile("Arrow.ico");
      goButton.Location = new Point(270,5);
      goButton.Size = new Size(20,20);
      goButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;

      panel1.Controls.AddRange(new Control[] { addressBox, goButton });
      panel2.Controls.Add(browser);
      this.Controls.AddRange(new Control[] { panel1, panel2 });

      browser.EndInit();
      panel1.ResumeLayout();
      panel2.ResumeLayout();
      this.ResumeLayout();

      goButton.Click += new EventHandler(goButton_Click);
      browser.GoHome();
   }

   private void goButton_Click(object sender, EventArgs e)
   {
      object o = null;
      browser.Navigate(addressBox.Text, ref o, ref o, ref o, ref o);
   }

   [STAThread]
   public static void Main()
   {
      Application.Run(new WebBrowser());
   }
}

           
       
Related examples in the same category
1.WebBrowser in action
2.My Web BrowserMy Web Browser
3.Web Browser usual actions
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.