Skip to content

Commit

Permalink
EnterでURLに移動できるように改修
Browse files Browse the repository at this point in the history
  • Loading branch information
ymd65536 committed Dec 21, 2021
1 parent e2530d2 commit 66bec3f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ public LegacyBrowser(bool InitFlag = true)
// イベントリスナの登録
this.ForwardBtn.Click += ForwardBtn_Click;
this.BackBtn.Click += BackBtn_Click;
this.GoUrlBtn.Click += UrlGo_Click;
this.GoUrlBtn.Click += GoUrlBtn_Click;
this.HomeBtn.Click += HomeBtn_Click;
this.UrlField.KeyDown += UrlField_KeyDown;
this.SizeChanged += Browser_SizeChanged;
Browser.Navigated += Browser_Navigated;
Browser.NewWindow2 += new NewWindow2EventHandler(Browser_NewWindow2);
Expand All @@ -88,14 +89,21 @@ private void ForwardBtn_Click(object sender, EventArgs e)
Browser.GoForward();
}
}
private void UrlGo_Click(object sender, EventArgs e)
private void GoUrlBtn_Click(object sender, EventArgs e)
{
Browser.Navigate(UrlField.Text.ToString());
}
private void HomeBtn_Click(object sender, EventArgs e)
{
Browser.GoHome();
}
private void UrlField_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Return)
{
Browser.Navigate(UrlField.Text.ToString());
}
}
private void Browser_SizeChanged(object sender, EventArgs e)
{
Browser.ClientSize = new Size(this.ClientSize.Width - 20, this.Height - 100);
Expand Down

0 comments on commit 66bec3f

Please sign in to comment.