如何限制多个窗体窗体在任务栏中显示并打开 [英] How to restrict multiple windows form to show in taskbar and open

查看:69
本文介绍了如何限制多个窗体窗体在任务栏中显示并打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用c#开发一个非常基本的桌面应用程序。

我有很多表单用于不同的操作,一切正常。

但我面临的一个问题就是这样,

假设我打开form2,然后是form3,它们是form4。

在任务栏中它显示了4种不同的形式(作为应用程序)。所以我希望它不应该在任务栏中显示多个任务只是主要形式,其次任何orher形式都无法打开,直到以前的形式才开始关闭。

一次只能打开一个表格。

我如何实施这一策略?对于我现在无法发布的代码感到厌烦。



我尝试了什么:



我对此一无所知,我非常熟悉桌面开发

I am developing a very basic desktop application in c#.
I that i have many forms for different operations everything is working fine.
But an issue i am facing is that,
Suppose i open form2, then form3 , them form4.
In taskbar it shows 4 different forms(as applications). So i want that it shouldnt show multiple tasks in taskbar just main form and secondly any orher form could not be opened untill previous form that is curently opened is closed.
Only one form should be open in a time.
How do i implement this strategy? SORRY for code i cant post right now.

What I have tried:

I have no idea about this, i am very beginner to desktop development

推荐答案

Sufian Matloob写道:
Sufian Matloob wrote:

,其次任何orher形式都无法打开,直到之前的形式已经关闭。

一次只能打开一个表格。

and secondly any orher form could not be opened untill previous form that is curently opened is closed.
Only one form should be open in a time.



根据描述它听起来你想打开另一个形式作为模态。如果是这种情况,那么您需要使用 Form.ShowDialog方法(系统。 Windows.Forms) [ ^ ]



例如


Based on the description it sounds you want to open the other form as modal. If this is the case then you need to use Form.ShowDialog Method (System.Windows.Forms)[^]

For example

Form2 f2 = new Form2();
f2.ShowDialog(this);



同样如上一个答案中所述,为防止表单显示在任务栏中,请将ShowInTaskBar属性设置为false。


Also as explained in the previous answer, to prevent the form from showing in the taskbar, set the ShowInTaskBar property to false.


您可以使用 Form.ShowInTaskbar Property( System.Windows.Forms) [ ^ ]。

请参阅 -

You can form your login using Form.ShowInTaskbar Property (System.Windows.Forms)[^].
See -
// Do not allow form to be displayed in taskbar.
myForm.ShowInTaskbar = false;







KR




KR


这篇关于如何限制多个窗体窗体在任务栏中显示并打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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