你好, 在这里,我有4种形式(Form1,Form2,Form3和Form4),Form1是MdiContainer(IsMdiContainer = true;),Form2,Form3和Form4是Mdichild形式. 在Form1 Load事件中,我编写了如下代码:
Hello, Here i is have 4 forms(Form1, Form2, Form3 and Form4) Form1 is MdiContainer(IsMdiContainer = true;), Form2, Form3 and Form4 are Mdichild forms. In Form1 Load event i wrote the code as follows:
private void Form1_Load(object sender, EventArgs e) { Form2 f2 = new Form2(); f2.MdiParent = this; f2.ShowDialog(); }在Form2表单中,我有两个按钮,分别称为"btnf3"和"btnf4". 1.如果我单击"btnf3" 我拥有将Form3作为Form1的MDI子窗体打开的功能,并且此Form2也必须关闭. (为结束此操作,我写了this.Hide();) 2.如果我单击"btnf4",我想以Form1的MDI子窗体形式打开Form4,并且还必须关闭Form2(MDI子窗体). 请告诉我我应该在那些按钮单击事件中写些什么 在此先谢谢您.
In Form2 form i have two buttons called "btnf3"and "btnf4". 1.If i click on "btnf3" i wnat to open Form3 as a MDI child form of Form1 and also this Form2 has to be closed. (for closing this i wrote this.Hide();) 2.If i click on "btnf4" i want to open Form4 as a MDI Child form of Form1 and also close Form2 (MDI child form) has to be closed. Please tell me what should i write in those buttons click events Thanks... in advance.
推荐答案这是正确执行操作的最佳方法:从不使用MDI. 这是一个主意:谁曾经需要MDI?为什么要折磨自己并吓users用户? 帮自己一个忙:完全不要使用MDI.没有设计,您可以更轻松地实现设计,并且质量更高.即使Microsoft也不鼓励使用MDI,实际上,Microsoft已将其从WPF中删除,并且几乎不支持它.更重要的是,如果您使用MDI,则会吓跑所有用户.只是不要.我可以解释该怎么办. 请参阅: en.wikipedia/wiki/Multiple_document_interface#Disadvantages [ ^ ], 如何在WPF中创建MDI父窗口? [ ^ ]. 并且还请查看我过去的答案以解释该怎么做: 在WPF中使用MDI窗口的问题 [ ^ ], MDIContainer提供错误 [ ^ ], 如何设置最大化的子表单,最后一个子表单最小化 [ ^ ]. 祝你好运,
看看类似的讨论:如何在标签中打开子窗口 [ ^ ] Take a look at similar discussion: How to Open Child Window in tab[^]
更多推荐
如何从MDIparent表单中的另一个MDIchild表单打开MDIchid表单
发布评论