通过最小化C#中的当前表单打开其他表单 [英] Open other form by minimizing current form in C#

查看:67
本文介绍了通过最小化C#中的当前表单打开其他表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有简单的C#应用​​程序,它有5个表单,所有表单都有最小化按钮但是当我最小化一个表单并尝试打开其他表单时它不起作用任何人给我解决方案提前感谢。



我的尝试:



i没有此问题的代码。

i have simple C# Application which have 5 forms and all the forms have minimize button but when i minimize one form and try to open other form it don't work any one give me solution thanks in advance.

What I have tried:

i have no code for this problems.

推荐答案

取决于它不起作用的意思,以及你究竟是怎么做的。



它不起作用可能是我们得到的最无用的问题报告 - 我们得到了很多。它没有告诉我们发生了什么,或者什么时候发生。

所以请告诉我们你做了什么,你没想到,或者不这样做。

告诉我们你做了什么来实现它。

告诉我们任何错误信息。

你给我们的信息越好,我们给你的帮助就越大。



我接近这个的方法是从你的应用程序启动时打开原始表单 - 打开所有其他表单,并控制发生的事情当它们被最小化时(假设最小化对你和我来说意味着同样的事情:缩减到任务栏但没有关闭)。

当我创建表单实例时,我会添加两个处理程序:FormClosed(所以我知道它应该是开放的)和Resize。在后面,我将检查表单的WindowState属性以查看它是否已被最小化:

Depends what "it don't work" means, and how exactly you are trying to do things.

"It doesn't work" is probably the most useless problem report we get - and we get it a lot. It tells us nothing about what is happening, or when it happens.
So tell us what it is doing that you didn't expect, or not doing that you did.
Tell us what you did to get it to happen.
Tell us any error messages.
The better the information you give us, the better the help we can give you.

The way I would approach this is to have one from - the form that original opens when your app starts - open all the others, and take control of what happens when they are minimized (assuming that "minimized" means the same thing to you and I: reduced to the task bar but not closed).
When I created the form instance, I'd add two handlers: FormClosed (So I know it's supposed to be open or not) and Resize. In the later, I'd check the WindowState property of the form to see if it has been minimized:
private void MyOtherForm_Resize ( object sender , EventArgs e )
    {
    Form f = sender as Form;
    if ( f != null && f.WindowState == FormWindowState.Minimized )
        {
        ... restore or open the other form ...
        }
    }


这篇关于通过最小化C#中的当前表单打开其他表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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