做一个多线程的程序,在新开的线程中需要实例化 一个ActiveX 控件,可是这个控件报错,信息如题。这个问题怎么解决?在网上看有用委托可以解决的,请问怎么写?

解决方案 »

  1.   

    窗体控件.Invoke((EventHandler)delegate{你的操作;});例如
    Form1的类中某个方法:
    this.Invoke((EventHandler)delegate{你的操作;});
      

  2.   

    能说再具体些吗?我是一个ActiveX 控件。
      

  3.   

    this.axGRDisplay = new AxgrproLib.AxGRDisplayViewer();
    这句报错!
      

  4.   

    使用[STAThread]
    COM   线程模型只适用于使用   COM   interop   的应用程序
      

  5.   

    试试看如梦提供的方法,这样试试看?
            static   class   Program
            {
                    [STAThreadAttribute]
                    static   void   Main()
                    {
                           
                            Application.EnableVisualStyles();
                            Application.SetCompatibleTextRenderingDefault(false);
                            Application.Run(new   FormMain());
                    }
            }