如何解决这个问题 [英] How Can fix this problem
本文介绍了如何解决这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何解决这个问题:
这是错误:
表格不能同时MDI子项和MDI父项。
参数名称:value
How Can fix this problem :
this is the error:
Form cannot be both an MDI child and MDI parent.
Parameter name: value
Form1 fm = new Form1();
fm.MdiParent = this;
fm.ShowDialog();
推荐答案
试试这个:
Try this:
Form1 fm = new Form1();
//fm.MdiParent = this;
fm.MdiParent = this.MdiParent;
fm.ShowDialog();
this.IsMdiContainer = true;
Form1 fm = new Form1();
fm.MdiParent = this;
fm.Show();
确保将此代码放入除Load之外的控制事件中。 (也不是构造函数)
*已添加
如果你试图在'Form1'类之外制作MDI表格,你应该像这样编码:
Be sure put this code into control events except Load. (nor constructor)
* ADDED
If you trying to make MDI form outside of 'Form1' class, you should coding like this:
Form1 parentForm = new Form1(); // Or other form classes
Form1 childForm = new Form1(); // same here
parentForm.IsMdiContainer = true;
childForm.MdiParent = parentForm;
parentForm.Show(); // Show the parent form first,
childForm.Show(); // and make visible inside of Mdi parent window.
希望这个帮助。
Hope this help.
这篇关于如何解决这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文