我如何在处理其他任务时最小化Windows Form应用程序 [英] How can i minimize the windows form application while processing other task

查看:66
本文介绍了我如何在处理其他任务时最小化Windows Form应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有Windows应用程序,它将启动其他进程来处理某些任务,直到那个时候该应用程序将最大化,但按预期是非活动的.但是我需要将任务栏上的应用程序最小化,并且在处理完成后将同一应用程序最大化.应用程序具有1个子窗体的MDI.我想从子窗体触发最小化机制..


请帮忙
Veer

Hi,

I have windows application which will start up other process for processing some tasks, till that time the application will be maximized but inactive as expected. But i need to minimize the application on to taskbar, and after the processing completes maximize the same application. Application has an MDI from 1 child form. I want to trigger the minimizing mechanism from Child form..


Please help
Veer

推荐答案

Parent.WindowState = FormWindowState.Minimized;







and

Parent.WindowState = FormWindowState.Maximized;


这里有一些不好的主意.首先,不要最小化或隐藏窗口.相反,执行冗长的操作是一个单独的线程,并且使UI可以访问,可见和响应,仅禁用某些控件.

其次,谁需要MDI?不要折磨自己并吓off用户.帮自己一个忙:完全不要使用MDI.没有设计,您可以更轻松地实现设计,并且质量更高.即使Microsoft也不鼓励使用MDI,实际上,Microsoft已将其从WPF中删除,并且几乎不支持它.更重要的是,如果您使用MDI,则会吓跑所有用户.只是不要.我可以解释该怎么做.请参阅:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages [在WPF中使用MDI窗口的问题 [ ^ ],
MDIContainer提供错误 [如何在WPF中创建MDI父窗口? [ ^ ],
如何最大程度地设置子表单,最小化最后一个子表单 [ ^ ].

关于使用UI进行线程化,请参阅我过去的答案:
http://www.codeproject.com/Answers/159125/Control-Invoke- vs-Control-BeginInvoke#answer1 [ ^ ],
Treeview Scanner和MD5问题 [
Couple of bad ideas here. First, don''t minimize or hide the window. Instead, perform your lengthy operation is a separate thread and leave you UI accessible, visible and responsive, only disable some controls.

Secondly, who needs MDI? Don''t torture yourself and scare 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. I can explain what to do instead. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to Create MDI Parent Window in WPF?[^],
How to set child forms maximized, last childform minimized[^].

As to the threading with UI, please see my past answers:
http://www.codeproject.com/Answers/159125/Control-Invoke-vs-Control-BeginInvoke#answer1[^],
Problem with Treeview Scanner And MD5[^].

—SA


这篇关于我如何在处理其他任务时最小化Windows Form应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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