【发布时间】:2011-07-28 00:26:47
【问题描述】:
我有一个能够通过 WebBrowser 对象打印 HTML 的打印机类。我希望能够从控制台应用程序进行打印,但是当我的打印机类尝试创建 WebBrowser 对象时出现错误:
WebBrowser browser = new WebBrowser();
错误:
ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot
be instantiated because the current thread is not in a
single-threaded apartment.
我尝试在我的控制台应用程序中添加对 System.Windows.Forms 的引用,但这不起作用。我对这里发生的事情一无所知,但我将不胜感激。
【问题讨论】:
-
如果仍有兴趣,请在this implementation 上循环。
标签: c# .net webbrowser-control console-application