求助,怎么在多线程中操作webbrowser 如题。我的程序需要自动操作webbrowser,因为流程比较多,不想界面上卡死。请问怎么在多线程中操作webrowser。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考代码:public partial class Form1 : Form { private void button1_Click(object sender, EventArgs e) { System.Threading.Thread s = new System.Threading.Thread(new System.Threading.ThreadStart(test)); s.ApartmentState = System.Threading.ApartmentState.STA; s.Start(); } public void test() { this.Invoke(new EventHandler(this.invokeTest)); } public void invokeTest(object sender,EventArgs e) { System.Windows.Forms.WebBrowser wb = new WebBrowser(); this.Controls.Add(wb); } public Form1() { InitializeComponent(); } } ??我窗体上已经有个webbrowser了,怎么操作它呢? 我在窗体上放了1个按钮 1个webbrowser点击按钮后,要让webbrowser打开10个网站采集数据 在非UI线程中操作UI线程是不允许的,可以采用2楼的方式。你在按钮中启动一个线程去完成你的出来操作,在这线程中访问ui的代码封装成方法或干脆用匿名方法,然后用this.Invoke()去调用。 c#使用DataSet读取xml文件数据问题求解 按椭圆排列 winform中二级联动的Combobox .NET 3.0 Windows Workflow Foundation研究群 dataGridView中某一列是CheckBox 一个构造问题........................高分.... 请问如何搭建cvs服务器端? 系统找不到Drawing怎么办 简单的题目,谢谢大家了,帮帮忙! 使用TreeView控件的问题(WebForm) C#如何改变FORM窗体标题的字体 请教C# richtext控件里画圆的方法
public partial class Form1 : Form
{ private void button1_Click(object sender, EventArgs e)
{
System.Threading.Thread s = new System.Threading.Thread(new System.Threading.ThreadStart(test));
s.ApartmentState = System.Threading.ApartmentState.STA;
s.Start();
} public void test()
{
this.Invoke(new EventHandler(this.invokeTest));
}
public void invokeTest(object sender,EventArgs e)
{
System.Windows.Forms.WebBrowser wb = new WebBrowser();
this.Controls.Add(wb);
}
public Form1()
{
InitializeComponent();
}
}
我窗体上已经有个webbrowser了,怎么操作它呢?
点击按钮后,要让webbrowser打开10个网站采集数据