c#winform中子窗体中弹出的窗体怎么设置成原来的子窗体

来源:百度知道 编辑:UC知道 时间:2024/05/23 03:23:58
有一个父窗体main 定义一个子窗体add,在窗体add中弹出一个窗体sun.
怎样才能把sun设置为窗体main的子窗体?

我写的:sun f1=new sun();
main f2=new main();
f1.MdiParent=f2;
f1.Show();
结果按下botton什么反映也没有....这是怎么回事?

风儿劲吹,黑暗被撕成碎片,
我的意志只要一样东西,一样我不知道的东西。
年轻的树,没有任何
默不作声,站着,听着
一个人很好,满眼自在
的活中来来往往的这个群哈哈

假设子窗体为FormChild, 子窗体弹出的窗体为SubChild, 那么:

FormChild fc = new FormChild();
....
SubChild sc = new SubChild();
sc.MdiParent = this.MdiParent;

加一句
add f1=new add();
f1.MdiParent=this;
f1.Show();

sun f2=mew sun();
f2.mdiparent=main();
f2.show();