检查表格是否打开 [英] Check If form Open or Not

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

问题描述


大家好

Hi All

我有主表格(frm_main),包括我要打开其他表格的菜单条现在我面临问题我想查看我要打开的表格

I have main Form (frm_main) and including menu strip that I want to open other form from it now I face issue I want to check the form that I want to open

如果它在后台打开或最小化状态显示最大值

if it open in the back ground or minimize state show it in maximize

如果没有打开我想打开它

if not open I want to open it

可以帮助我

推荐答案

你可以确定如果表单是使用

You can determine if the form is open using

if (Application.OpenForms.OfType<YOUR_FORM>().Any())
    MessageBox.Show("Form is opened");
else
    MessageBox.Show("Form is not opened");

如果它在后台

Application.OpenForms["YOUR_FORM"].BringToFront();


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

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