Form.Owner 属性


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

 property System::Windows::Forms::Form ^ Owner { System::Windows::Forms::Form ^ get(); void set(System::Windows::Forms::Form ^ value); };
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 的窗体,该窗体由名为 Form1的窗体拥有。For 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 拥有的窗体(如查找和替换窗口),在选择所有者窗体时,这些窗体不会消失。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.