表格相关 [英] Form related

查看:96
本文介绍了表格相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取C#中所有表单的列表.
意思是...
-openforms
-隐藏表格
-看不见的形式

请帮助我!

How do I get a list of all the forms in C#.
Meaning...
- openforms
- hide forms
- invisible forms

Please help me!

推荐答案

您不说您使用的是哪个版本的C#或.NET.另外,您不会说是否正在使用WPF.

在.NET Framework 2.0和更高版本中,在System.Windows.Forms名称空间中,有一个OpenForms 属性,该属性返回一个FormsCollection.

您也可以使用Application.OpenForms.例如:

You do not say which version of C# or .NET you are using. Also, you do not say if you are using WPF or not.

In .NET Framework 2.0 and later, in the System.Windows.Forms namespace, there is the OpenForms property which returns a FormsCollection.

You can also use Application.OpenForms. For example:

foreach (Form form in Application.OpenForms)
{
    //do something with the forms
}


Application.OpenForms将为您提供所有当前打开的表单,无论它们处于可见状态还是启用状态.
Application.OpenForms will give you all forms currently open, regardless of their visible or enabled state.


这篇关于表格相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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