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 MyBrowser
{
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
partial class Form1
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.webBrowser = new System.Windows.Forms.WebBrowser();
this.buttonSend = new System.Windows.Forms.Button();
this.textBoxUrl = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.buttonNext = new System.Windows.Forms.Button();
this.buttonPrev = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.buttonPrev);
this.panel1.Controls.Add(this.buttonNext);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.textBoxUrl);
this.panel1.Controls.Add(this.buttonSend);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(638, 47);
this.panel1.TabIndex = 0;
//
// webBrowser
//
this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser.Location = new System.Drawing.Point(0, 47);
this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser.Name = "webBrowser";
this.webBrowser.Size = new System.Drawing.Size(638, 269);
this.webBrowser.TabIndex = 1;
this.webBrowser.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.webBrowser_Navigating);
//
// buttonSend
//
this.buttonSend.Location = new System.Drawing.Point(547, 8);
this.buttonSend.Name = "buttonSend";
this.buttonSend.Size = new System.Drawing.Size(79, 28);
this.buttonSend.TabIndex = 0;
this.buttonSend.Text = "送出";
this.buttonSend.UseVisualStyleBackColor = true;
this.buttonSend.Click += new System.EventHandler(this.buttonSend_Click);
//
// textBoxUrl
//
this.textBoxUrl.Location = new System.Drawing.Point(211, 12);
this.textBoxUrl.Name = "textBoxUrl";
this.textBoxUrl.Size = new System.Drawing.Size(330, 22);
this.textBoxUrl.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("DFKai-SB", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
this.label1.Location = new System.Drawing.Point(156, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 21);
this.label1.TabIndex = 2;
this.label1.Text = "網址";
//
// buttonNext
//
this.buttonNext.Location = new System.Drawing.Point(77, 12);
this.buttonNext.Name = "buttonNext";
this.buttonNext.Size = new System.Drawing.Size(75, 23);
this.buttonNext.TabIndex = 3;
this.buttonNext.Text = "下一頁";
this.buttonNext.UseVisualStyleBackColor = true;
this.buttonNext.Click += new System.EventHandler(this.buttonNext_Click);
//
// buttonPrev
//
this.buttonPrev.Location = new System.Drawing.Point(0, 12);
this.buttonPrev.Name = "buttonPrev";
this.buttonPrev.Size = new System.Drawing.Size(75, 23);
this.buttonPrev.TabIndex = 4;
this.buttonPrev.Text = "上一頁";
this.buttonPrev.UseVisualStyleBackColor = true;
this.buttonPrev.Click += new System.EventHandler(this.buttonPrev_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(638, 316);
this.Controls.Add(this.webBrowser);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBoxUrl;
private System.Windows.Forms.Button buttonSend;
private System.Windows.Forms.WebBrowser webBrowser;
private System.Windows.Forms.Button buttonPrev;
private System.Windows.Forms.Button buttonNext;
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
goUrl("http://tw.yahoo.com");
}
private void buttonSend_Click(object sender, EventArgs e)
{
goUrl(textBoxUrl.Text);
}
public void goUrl(String url)
{
webBrowser.Navigate(url);
textBoxUrl.Text = url;
}
private void webBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
textBoxUrl.Text = webBrowser.Url.ToString();
}
private void buttonNext_Click(object sender, EventArgs e)
{
webBrowser.GoForward();
}
private void buttonPrev_Click(object sender, EventArgs e)
{
webBrowser.GoBack();
}
}
}