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.Date Time
8.Design Patterns
9.Development Class
10.Event
11.File Stream
12.Generics
13.GUI Windows Form
14.Internationalization I18N
15.Language Basics
16.LINQ
17.Network
18.Office
19.Reflection
20.Regular Expressions
21.Security
22.Services Event
23.Thread
24.Web Services
25.Windows
26.Windows Presentation Foundation
27.XML
28.XML LINQ
C# Book
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
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.