ActiveX控件无法实例,因为当前线程不是在一个单一的线程单元线程、在一、控件、实例

2023-09-06 09:15:03 作者:心在旅途

由于对象是自explainatory,我需要帮助。

As the subject is self explainatory, I need help.

我正在写一个小工具,启动时显示一个闪屏。 启动画面是一个形式。当只有一个按钮控件上它是工作的罚款。 但是,当我删除它,放在一个WebBrowser控件就可以了,它抛出上述异常。

I'm writing a small tool that displays a splash screen when starting. The splash screen is a Form. When there was only a Button control on it it was working fine. But when I removed it and placed a WebBrowser control on it, it throws the above exception.

在此先感谢。

推荐答案

您使用的WinForms?如果是这样,请尝试将[STAThread]属性的类定义的顶部,看看会发生什么:

Are you using WinForms? If so, try placing the [STAThread] attribute at the top of your class definition and see what happens:

命名空间WindowsFormsApplication1 {     [STAThread]     公共部分类Form1中:形态     {

namespace WindowsFormsApplication1 { [STAThread] public partial class Form1 : Form {