using System;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Uri address = new Uri(textBox1.Text);//创建uri类型变量,存储浏览网页地址
            webBrowser1.Url = address;

        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)//如果按下的是Enter键
            {
                if (textBox1.Text!="")
                {
                    button1_Click(sender, e);
                }
            }
        }
       
    }
}

相关文章:

  • 2021-08-26
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2021-12-03
  • 2021-08-03
猜你喜欢
  • 2021-10-04
  • 2021-11-08
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2021-08-18
相关资源
相似解决方案