C#的WebBrowser控件浏览网页

C#的WebBrowser控件浏览网页_第1张图片

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);
        }
    }
}


你可能感兴趣的:(《VS/C/C++/C#》)