[英]C# : Prevent child modal form from creating instance on taskbar
I have a parent form. 我有一个父表格。 When i click a button, a modal child form appeare within the form and is located at the center of the parent form :
当我单击一个按钮时,模式子表单出现在表单中并位于父表单的中心:
but the problem is in the taskbar, the application have 2 instances : 但问题是在任务栏中,应用程序有2个实例:
How do i prevent this second instance or Hide it from the taskbar ? 如何防止第二个实例或从任务栏中隐藏它? Thanks !
谢谢 !
When you instantiate the second form, set the ShowInTaskbar
property to False
to prevent it from showing up in the Windows task bar. 实例化第二个表单时,将
ShowInTaskbar
属性设置为False
以防止它显示在Windows任务栏中。
You don't show the code where you instantiate and display the form, but something like this should work: 您没有显示实例化和显示表单的代码,但是这样的事情应该有效:
var secondForm = new Form2
{
ShowInTaskbar = false,
StartPosition = FormStartPosition.CenterParent
};
secondForm.ShowDialog();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.