Hello everyone,I am in front of an issue about mdi child window launched from an automation interface. In my WinForm application, I have a mainframe, a CManager automation class, and a frm child window which will display a 2d object once the CManager.Create2DWindow is invoked.I am trying the 2d child window creation from vb6, this works until I come to the .MDIParent property, this blows up the cross-thread exception. To simulate it I have tried the experimentation directly from a thread started in CManager.Start()I have the following code:public bool Start(){ Thread create2DFromThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.Start2DFrom)); create2DFromThread.IsBackground = true; create2DFromThread.SetApartmentState(ApartmentState.STA); create2DFromThread.Start();}private void Start2DFrom(){ frm2D frm = null; frm2D = new frm2D(); frm.MdiParent = m_WindowParent; // --> Illegal Cross Thread Exception. frm.Show();}I have also tried with delegate but this does not fix the issue.Do you have an idea how this could be solved ?Thank you very much in advance. 解决方案 这篇关于C#:如何在线程中使用.MDIParent?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 06:45