如何查找隐藏表单的时间 [英] how to find when the form is hidden

查看:107
本文介绍了如何查找隐藏表单的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


晚上好
我的应用程序在某些地方隐藏了表单,当时我想检索的任何时候,我都想获取隐藏的对应表单,如果那时没有对应的隐藏表单,我想在那时调用相应的表单使用a.show();(即对象)


在Windows应用程序C#.net中
请给我一个主意

hi


good evening
i my application i am hidding the forms at some places , when ever i want to retrive at that time i want to get the hidden correspondingform , if there is no corresponding hidden form at that time i want to call the correspoding form at that time by using a.show();(i.e object)


in windows application C#.net
please give me a idea

推荐答案

您隐藏在哪里?

看看是否保持引用打开,只需调用引用即可获取文件.

Form frm = new Form();

现在,如果您使用
隐藏 frm.Hide();

它会被隐藏.要显示相同的文件,请使用
from.Show();

如果您没有frm,则表示该对象超出范围,将在垃圾回收过程中.

另一方面,如果您希望表单不受强引用的约束,以便将其留给垃圾收集,但仍要检查表单是否尚未被垃圾收集,则需要为此使用WeakReference .

我写了一篇关于如何使用WeakReference增强应用程序性能的文章.您可以阅读:
http://www.abhisheksur.com/2010/07/garbage-collection- algorithm-with-use.html [ ^ ]

:thumbsup:
Where are you hiding?

See if you are keeping the reference open, just call the reference to get the file.

Form frm = new Form();

now if you hide using
frm.Hide();

it will be hidden. To show the same file use
from.Show();

If you dont have frm with you, that means the object is out of scope and will be in process of Garbage collection.

On the other hand, if you want your form to be out of strong reference so that it will be left for garbage collection but still want to check whether the form is not yet garbage collected or not, you need to use WeakReference for that.

I have written one article on how you can use WeakReference to enhance performance of your application. You may read :
http://www.abhisheksur.com/2010/07/garbage-collection-algorithm-with-use.html[^]

:thumbsup:


每当您隐藏或显示Form或任何其他控件时,其Visible属性都会更改,因此您可以通过Visible属性检查Form是否被隐藏.
Whenever you hide or show a Form or any other Control its Visible property changes, so you can check through Visible property that Form is hidden or not.


这篇关于如何查找隐藏表单的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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