关闭当前mdichild表单并使用c#中的单个方法打开另一个 [英] close current mdichild form and open another with single method in c#

查看:83
本文介绍了关闭当前mdichild表单并使用c#中的单个方法打开另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有

i有一个名为masterform的主表单

i希望所有其他表单在masterform环境中打开和关闭



i想要一个可以获得2个参数的方法:1 - 活动子表单2 - 需要打开的表单



现在我的问题是:

1 - 检测参数1的当前子表单(请注意,同时只有1个子表单处于活动状态)

2-什么是参数类型(我设置Form类但我可以' t发送Form2,必须先创建它的实例)



我的解决方案是:

  void  manageform(表单closeForm,表单openform)
{
closeForm.Close();

openform.MdiParent = ;
openform.Menu = null ;
openform.Text = ;
openform.ControlBox = false ;
openform.Dock = DockStyle.Fill;
openform.MinimizeBox = false ;
openform.MaximizeBox = false ;
openform.Show();
}



并将其称为:

 Form1 f1 = new Form1(); 
Form2 f2 = new Form2();
manageform(f1,f2);





请帮帮我



谢谢我的朋友们div class =h2_lin>解决方案

这个想法是:谁需要MDI?为什么要折磨自己并吓跑你的用户?

帮自己一个大忙:根本不要使用MDI。没有它,您可以更轻松地实现设计,质量更好。 MDI甚至被微软高度劝阻,事实上,微软将其从WPF中删除并且很难支持它。更重要的是,如果您使用MDI,您将吓跑所有用户。只是不要。请参阅:

http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages [ ^ ],

如何在WPF中创建MDI父窗口? [ ^ ]。



我可以解释做什么。请看我过去的答案:

如何在WPF中创建MDI父窗口? [解决方案2 ],

关于在WPF中使用MDI窗口的问题 [ ^ ],

麦当劳给出错误 [ ^ ],

如何设置子窗体最大化,最后一个子窗体最小化 [ ^ ]。



-SA

hi all
i have a master form with name masterform
i want all other form open and close in masterform Enviroment

i want a method that can get 2 parameters : 1-active child form 2 - form that need to open

Now my problem is :
1-Detect current child form for parameter 1 (Notice that in same time only 1 child form is active)
2- what is type of parameter (i set Form class but i can't send Form2 and must first create instance of it)

my solution is :

void manageform(Form closeForm,Form openform)
       {
           closeForm.Close();

           openform.MdiParent = this;
           openform.Menu = null;
           openform.Text = "";
           openform.ControlBox = false;
           openform.Dock = DockStyle.Fill;
           openform.MinimizeBox = false;
           openform.MaximizeBox = false;
           openform.Show();
       }


and call it like :

Form1 f1 = new Form1();
Form2 f2=new   Form2();
manageform(f1,f2);



please help me

thanks my friends

解决方案

Here is the idea: who needs MDI, ever? Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don't. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
How to Create MDI Parent Window in WPF?[^].

I can explain what to do instead. Please see my past answers:
How to Create MDI Parent Window in WPF? [Solution 2],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].

—SA


这篇关于关闭当前mdichild表单并使用c#中的单个方法打开另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆