开发者

C# SetParent and Modal on different executables

I have two executables in C#, lets call them executable A and B, both of them have one form. Executable A gets the MainWindowHandle of B and then calls SetParent(this.Handle, B.M开发者_Go百科ainWindowHandle). How can I set the form of executable B to be a Modal so that the form of executable A wont receive input unless I close the form B. Something like when you do frm.ShowDialog(). Thank you very much.


Well, given AForm and BForm, I've created a test project which references another Winforms project (which contains BForm), and I can do this:

private void button1_Click(object sender, EventArgs e)
{
  var bForm = new WindowsFormApplication2.BForm();
  bForm.ShowDialog(this);
}

With or without passing in an IWin32Window owner property to the ShowDialog function, mine correctly forces modal on my BForm.

Can you show us some code?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜