C implements a complete example of a simple browser based on the IE kernel
- 2021-07-13 06:07:14
- OfStack
This article illustrates how C # implements a simple browser based on the IE kernel. Share it for your reference. The details are as follows:
Form1.cs is as follows:
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 Kit_Browser
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
comboBox1.SelectedIndex = 0;
webBrowser1.GoHome();
}
private void goButton_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(new Uri(comboBox1.SelectedItem.ToString()));
}
private void Navigation ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void Home page ToolStripMenuItem_Click(object sender, EventArgs e)
{
webBrowser1.GoHome();
}
private void Return ToolStripMenuItem_Click(object sender, EventArgs e)
{
webBrowser1.GoForward();
}
private void Advance ToolStripMenuItem_Click(object sender, EventArgs e)
{
webBrowser1.GoBack();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show(" Author: Li Bowen \nQ Q : 1053112601","Kit Browser");
}
}
}
The application entry file is as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Kit_Browser
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Click here to download the complete example code.
I hope this article is helpful to everyone's C # programming.