向MDI添加不同的应用程序 [英] Add different applications to MDI

查看:109
本文介绍了向MDI添加不同的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以向MDI添加不同的应用程序吗?

这是我的MDI表单的屏幕截图。



http://img267.imageshack.us/img267/5222/mdiv.jpg [ ^ ]



之前我创建了多个应用程序,现在我想将它们添加到此MDI中。那么如何添加呢?我是否必须将所有项目导入我的MDI项目?我是MDI的新手。



希望我的问题很明确。

解决方案

首先,问题毫无意义。没有向应用程序添加应用程序这样的事情。



如果你只是想要运行一个应用程序(启动子进程),你可以做到了,但你打算用它做什么?流程非常孤立。如果它们不是故意为某些协作而设计的,那么你就无法做很多事情。不建议尝试做这些事情。即使您可以在某些表单中插入子应用程序的主窗口(当它出现时),这是一个肮脏的技巧,这将使情况更糟。它仅适用于Windows,因为当Windows不是操作系统时,其旧版Windows功能继承了旧版本。如果将在某个主机窗体内运行,其中包含所有非客户端区域,而这些区域将反过来制动所有可接受的UI样式;而你仍然无法真正掌控应用程序。不要考虑它。



但是,如果子应用程序是仅限控制台的应用程序,您可以非常轻松地重定向 StandardOutput 并在表单中显示结果。从这个MDSN帮助页面可以看出这个想法,其代码示例如下:

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx [ ^ ]。



现在,关于你的MDI ...



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

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

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

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



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

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

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

麦当劳给出错误 [ ^ ],

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



-SA

Can we add different applications to MDI??
Here is the screen shot of my MDI form.

http://img267.imageshack.us/img267/5222/mdiv.jpg[^]

I have created multiple applications before and now I want to add them to this MDI. So how to add them? Do I have to import all projects to my MDI project? I am new to MDI.

Hope my question is clear.

解决方案

First of all, the question makes no sense. There is no such thing as "add application to an application".

If you simply mean that you want to run an application (start a child process), you can do it, but what are you going to do with it? Processes are very well isolated. If they are not intentionally designed for some collaboration, you cannot do much about it. Trying to do such things is not recommended. Even though you can insert a main window of child application (when and if it appears) in some of your forms, this is a dirty trick which will makes the situation even worse. It works with Windows only because its legacy functionality inherited from old Windows versions when Windows was not an OS yet. If will run inside some host form, with all its non-client areas, which, in turn, will brake all the acceptable UI styles; and you still won''t have a real control over the application. Don''t even think about it.

However, if the child application is a console-only application, you can pretty easily redirect StandardOutput and show the results in your form. The idea is apparent from this MDSN help page, with a code sample:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx[^].

Now, about your MDI…

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


这篇关于向MDI添加不同的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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