读书人

新手请问webbrowser的使用有关问题

发布时间: 2013-07-09 09:50:48 作者: rapoo

新手请教,webbrowser的使用问题,请进
新手请问,webbrowser的使用有关问题,请进
[解决办法]
WebBroser 只能在单线程中使用即STA模式

而System.Timers.Timer为多线程,访问便会出错,所以,修改如下

System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
timer.Interval = 2000;
timer.Enabled = true;
timer.Tick += (s, args) =>
{
MessageBox.Show(wb.DocumentTitle);
};

读书人网 >C#

热点推荐