如何在C#中制作所有者表单 [英] how to make owner form in c#

查看:74
本文介绍了如何在C#中制作所有者表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在c#中成为所有者

i want to make a owner from in c#
how to do this..?

推荐答案

这里是方法:

Here is how:

myForm.Owner = someOtherForm;



您也可以使用System.Windows.Forms.Form.AddOwnedForm.请参阅:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.owner.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.addownedform.aspx [ ^ ].

为了保持应用程序的一致性,让所有表单归其他表单拥有,这是非常重要的,除了它们是主表单;通常最好将所有表单归主表单所有.所有所有权都指向主要形式,这很重要.如果不这样做,则所有表单的行为都将类似于独立应用程序:在Z顺序的应用程序表单之间可能会出现任何其他应用程序的窗口,这不是很好.

出于类似的原因,最好将除主窗体以外的所有窗体的属性ShowInTaskbar分配为false:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.showintaskbar.aspx [ ^ ].

—SA



You can also use System.Windows.Forms.Form.AddOwnedForm. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.owner.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.addownedform.aspx[^].

For application consistency, it''s very important to make all forms owned by other forms, except them main form; it''s usually the best to have all forms owned by the main one. It''s is only important that all ownership leads to the main form. If you don''t do it, all forms would behave like that of independent application: a window of any different application may appear between the forms of your application in Z-order, which is not nice.

For the similar reason, it''s good to assign the property ShowInTaskbar to false for all forms except the main one:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.showintaskbar.aspx[^].

—SA


这篇关于如何在C#中制作所有者表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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