本文介绍了如何从FormB打开FormC作为FormA的MDI_Child的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是C#.NET的初学者,尝试编写代码。我有三个Windows.Form:
1. MainForm(MDI_FORM)
2. Child1
3. Child2
在MainForm上,我命令Child1。显示()
然后从Child1,我打算通过以下代码分配并打开Child2作为孩子到MainForm:
在MainForm上,我声明:
public static Child2 child2;
然后在来自Child1的btnOpen上,我编码:
private void btnOpen_Click(object sender,EventArgs e)
{
MainForm mainForm = new MainForm();
mainForm.child2 = new Child2();
mainForm.child2.MdiParent = fMainForm;
mainForm.child2.Show();
}
有人帮我做点什么。
这不起作用。
非常感谢!!!
解决方案
I am a beginner on C# .NET, trying to code out something. I have three Windows.Form: 1. MainForm (MDI_FORM) 2. Child1 3. Child2 On MainForm, I commanded Child1.Show() Then from Child1, I intend to assign and open Child2 as a child to MainForm via the codes below: On MainForm, I declared: public static Child2 child2; Then on btnOpen from Child1, I coded: private void btnOpen_Click(object sender, EventArgs e) { MainForm mainForm = new MainForm(); mainForm.child2 = new Child2 (); mainForm.child2.MdiParent = fMainForm; mainForm.child2.Show(); } Someone help me on what to do please. It's not working. Thanks a lot!!!
解决方案
这篇关于如何从FormB打开FormC作为FormA的MDI_Child的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!