【发布时间】:2015-09-12 12:56:04
【问题描述】:
System.Windows.Forms.dll webbrowser 控件中出现“System.Threading.ThreadStateException”类型的未处理异常
我正在尝试捕获视频的帧,然后在单独的线程中处理它们。处理完框架后,我需要调用一个包含 webBrowser 控件的表单,以将网页显示为第一个 winform 的覆盖层。
有什么办法可以在我用来处理帧的类中调用这个表单。如果我这样做了,我会一直被上述异常所困扰。
我在 SO 和其他论坛上进行了研究,但找不到任何解决此问题的方法。这是我的代码:
class FrameProcessor
{
//This line results in the above stated Exception.
webForm frm=new webForm ();
frm.Show();
}
有什么解决办法吗?任何建议将不胜感激。
【问题讨论】:
-
“我在 SO 和其他论坛上进行了研究,但找不到任何解决方案” - 天哪,看看我在右边空白处找到了什么。 Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on
标签: c# multithreading winforms