-
Notifications
You must be signed in to change notification settings - Fork 0
/
Web.cs
88 lines (76 loc) · 1.73 KB
/
Web.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WebBrowser
{
public partial class Web : Form
{
List<string> Fav = new List<string>();
private void UpdateCBX()
{
foreach (string content in Fav)
{
CbxFav.Items.Add(content);
}
}
public Web()
{
InitializeComponent();
}
private void Web_Load(object sender, EventArgs e)
{
}
private void Web_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F5)
{
e.Handled = true;
BtnReload.PerformClick();
}
if (e.KeyCode == Keys.Enter)
{
if (TxtSearch.Text.Trim() != string.Empty)
{
WbBrowser.Navigate(TxtSearch.Text);
}
if (CbxFav.Text.Trim() != string.Empty)
{
WbBrowser.Navigate(CbxFav.Text);
}
}
if (e.KeyCode == Keys.Escape)
{
this.Close();
}
}
private void BtnBack_Click(object sender, EventArgs e)
{
WbBrowser.GoBack();
}
private void BtnForward_Click(object sender, EventArgs e)
{
WbBrowser.GoForward();
}
private void BtnReload_Click(object sender, EventArgs e)
{
WbBrowser.Refresh();
}
private void BtnHome_Click(object sender, EventArgs e)
{
WbBrowser.GoHome();
}
private void BtnSearch_Click(object sender, EventArgs e)
{
WbBrowser.Navigate(TxtSearch.Text);
}
private void BtnFav_Click(object sender, EventArgs e)
{
Fav.Add(WbBrowser.Url.ToString());
UpdateCBX();
}
private void CbxFav_SelectedIndexChanged(object sender, EventArgs e)
{
WbBrowser.Navigate(CbxFav.SelectedItem.ToString());
}
}
}