简体   繁体   English

从子表单中引用主表单

[英]Refer to the main form from child form

I have a main form and that open a child: 我有一个主要的形式,并打开一个孩子:

Preeee p = new Preeee();
p.MdiParent = this;
p.Show();

and in certain point the child form will closes and opens it self: 子窗体在某些时候会自行关闭并打开:

Preeee p = new Preeee();
p.MdiParent = this;
p.Show();
this.Close();

but of course this in the second line refer to itself but i want it to refer to another form witch is the main form 但当然this在第二行是指本身,但我希望它是指另一种形式是女巫的主要形式

看来您只想让父母同住,您可以这样做:

p.MdiParent = this.MdiParent;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM