共用方式為


Form.Owner 屬性

定義

取得或設定擁有此表單的表單。

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; }
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Form? Owner { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Owner : System.Windows.Forms.Form with get, set
Public Property Owner As Form

屬性值

A Form 代表該形式擁有者的形式。

屬性

例外狀況

頂層視窗不能有擁有者。

備註

要讓一個表單被另一個表單擁有,請將其屬性指 Owner 派到將成為擁有者的表單。

當一個表單被另一個表單擁有時,該表單會被封閉或隱藏,連同擁有者表單一起。 例如,考慮一個名為 Form2 的形式,該形式由一個名為 Form1的形式擁有。 如果 Form1 是閉合或最小化,則 Form2 也是閉合或隱藏的。 擁有的表單也絕不會顯示在擁有者表單後方。 你可以用擁有的表單來處理視窗,例如尋找和替換視窗,選擇擁有者表單時這些表單不應該會消失。 要判斷父表單擁有哪些表單,請使用該 OwnedForms 屬性。

適用於

另請參閱