C#的WebBrowser控制浏览



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 openUrl
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            string add = "";
            if (!(txtUrl.Text.Trim().StartsWith("http://")))
            {
                add = "http://" + txtUrl.Text.Trim();
                txtUrl.Text = add;
            }
            webBrowser1.Url = new Uri(add);
        }
    }
}


版权声明:本文博主原创文章。博客,未经同意,不得转载。

原文地址:https://www.cnblogs.com/mfrbuaa/p/4757804.html