2010 12 21

Browser

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace browser
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            webBrowser1.Url = new Uri("http://www.google.com");
        }

        private void webBrowser1_DocumentCompleted(object sender, 
            WebBrowserDocumentCompletedEventArgs e)
        {
            toolStripComboBox1.Text = webBrowser1.Url.ToString();//網頁顯示出來時網址也出來
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            webBrowser1.GoBack();//上一頁
            toolStripComboBox1.Text = webBrowser1.Url.ToString();
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            webBrowser1.GoForward();//下一頁
            toolStripComboBox1.Text = webBrowser1.Url.ToString();
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            goUrl(toolStripComboBox1.Text);//連結至輸入的網址
        }

        public void goUrl(String url)
        {
            webBrowser1.Navigate(url);
            toolStripComboBox1.Text = url;
        }

        private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            toolStripComboBox1.Text = webBrowser1.Url.ToString();//網址列上網址隨點選的網頁顯示
        }

        private void tSBw_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate("http://bluesky826.wikidot.com");//連結至我的網站
            toolStripComboBox1.Text = webBrowser1.Url.ToString();
        }
    }
}

browser.JPG
browser.exe

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License