Form.Owner Form.Owner Form.Owner Form.Owner Property

定义

获取或设置拥有此窗体的窗体。Gets or sets the form that owns this form.

public:
 property System::Windows::Forms::Form ^ Owner { System::Windows::Forms::Form ^ get(); void set(System::Windows::Forms::Form ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Form Owner { get; set; }
member this.Owner : System.Windows.Forms.Form with get, set
Public Property Owner As Form

属性值

Form,表示作为此窗体的所有者的窗体。A Form that represents the form that is the owner of this form.

异常

顶级窗口不能具有所有者。A top-level window cannot have an owner.

注解

若要使窗体拥有的另一种形式,将分配其Owner对将成为所有者的窗体的引用的属性。To make a form owned by another form, assign its Owner property a reference to the form that will be the owner.

当窗体拥有的另一种形式时,它已关闭或隐藏与所有者窗体。When a form is owned by another form, it is closed or hidden with the owner form. 例如,考虑名为窗体Form2归名为窗体Form1For example, consider a form named Form2 that is owned by a form named Form1. 如果Form1已关闭或最小化Form2也会关闭或隐藏。附属窗体也永远不会显示在其所有者窗体后面。If Form1 is closed or minimized, Form2 is also closed or hidden.Owned forms are also never displayed behind their owner form. 可以使用如查找 windows 附属窗体和替换 windows,选择所有者窗体时应不会消失。You can use owned forms for windows such as find and replace windows, which should not disappear when the owner form is selected. 若要确定所拥有的父窗体的窗体,请使用OwnedForms属性。To determine the forms that are owned by a parent form, use the OwnedForms property.

适用于

另请参阅