C#窗体应用程序中webBrowser控件中的网页完全复制到另一个窗口中的webBrowser控件中

2024-12-27 22:10:58
推荐回答(1个)
回答1:

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

private void btn_Create_Click(object sender, EventArgs e)
{
Form2 f = new Form2(this.webBrowser1.Url.ToString());
f.ShowDialog();
}
}
Form2:
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

public Form2(string url)
: this()
{
this.webBrowser1.Url = new Uri(url);
}
}