问在splitcontainer面板中打开新表单时如何关闭表单 [英] ask how to close a form when open a new form in panel of splitcontainer
本文介绍了问在splitcontainer面板中打开新表单时如何关闭表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在splitcontainer面板中打开新表单时如何关闭表单
how to close a form when open a new form in panel of splitcontainer
推荐答案
简短的答案是:Form.Close()
,http://msdn.microsoft.com/en-us/library/system.windows.forms.form .close.aspx [ ^ ].
问题的细节根本不清楚.除了病理情况外,表格不能在面板中.是的,您可以将其作为子控件粘贴到面板中,但是通常它会引发异常,而且我认为没有必要使用它的情况.
此外,通过这种调用关闭表单通常不是人们通常在合理设计中所做的.您应该了解,您将无法再次打开该表单的同一实例.只是警告您...
我建议您从有关技术的目的和应用程序的最终目标入手,提出更详细的问题.
—SA
The short answer is:Form.Close()
, http://msdn.microsoft.com/en-us/library/system.windows.forms.form.close.aspx[^].
The details of the question are not clear at all. A form, pathological cases aside, cannot be in a panel. Yes, you can stick it into a panel as a child control, but normally it would throw an exception, and I see no situations where it could be needed.
Besides, closing a form by this call is usually not what people typically do in a reasonable design. You should understand that you won''t be able to open the same instance of the form again. Just to warn you…
I would advise that you ask questions providing more detail, starting with the purpose of the technique in question and the ultimate goals of your application.
—SA
获取打开的表单的实例并调用其close方法.表单具有关闭方法.
例如
您有一个form1
您可以执行form1.Close();
如果您无权访问该表格,则可以引发一个事件以将其关闭.
Get the instance of opened form and call its close method. Form has a close method.
e.g.
you have got a form1
you can do form1.Close();
if you don''t have access to that form then you can raise an event to close it as well.
这篇关于问在splitcontainer面板中打开新表单时如何关闭表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文