Aracılığıyla paylaş


Form.AddOwnedForm(Form) Yöntem

Tanım

Bu forma sahip olunan bir form ekler.

public:
 void AddOwnedForm(System::Windows::Forms::Form ^ ownedForm);
public void AddOwnedForm(System.Windows.Forms.Form ownedForm);
public void AddOwnedForm(System.Windows.Forms.Form? ownedForm);
member this.AddOwnedForm : System.Windows.Forms.Form -> unit
Public Sub AddOwnedForm (ownedForm As Form)

Parametreler

ownedForm
Form

Form Bu formun sahip olacağı form.

Örnekler

Aşağıdaki örnek, bir formu başka bir formun AddOwnedForm sahip olduğu form olarak görüntülemek için yönteminin nasıl kullanılacağını gösterir. Sahip olunan form gösterildikten sonra sahip formunu simge durumuna küçültebilirsiniz ve sahip olunan form da bu formla simge durumuna küçültülür. Örnek, örnekteki kodun başka bir olaydan veya formun yönteminden çağrıldığını gerektirir.

private:
   void ShowMyOwnedForm()
   {
      // Create an instance of the form to be owned.
      Form^ ownedForm = gcnew Form;

      // Set the text of the form to identify it is an owned form.
      ownedForm->Text = "Owned Form";

      // Add ownedForm to array of owned forms.
      this->AddOwnedForm( ownedForm );

      // Show the owned form.
      ownedForm->Show();
   }
private void ShowMyOwnedForm()
{
   // Create an instance of the form to be owned.
   Form ownedForm = new Form();
   // Set the text of the form to identify it is an owned form.
   ownedForm.Text = "Owned Form";
   // Add ownedForm to array of owned forms.
   this.AddOwnedForm(ownedForm);

   // Show the owned form.
   ownedForm.Show();
}
Private Sub ShowMyOwnedForm()
   ' Create an instance of the form to be owned.
   Dim ownedForm As New Form()
   ' Set the text of the form to identify it is an owned form.
   ownedForm.Text = "Owned Form"
   ' Add ownedForm to array of owned forms.
   Me.AddOwnedForm(ownedForm)

   ' Show the owned form.
   ownedForm.Show()
End Sub

Açıklamalar

Sahip formuna atanan form, yöntem çağrılana RemoveOwnedForm kadar sahip olmaya devam eder. Ayrıca, özelliği sahip formuna bir başvuruyla ayarlayarak başka bir formun Owner sahibi de olabilirsiniz.

Bir form başka bir forma ait olduğunda, form sahibi formuyla kapatılır veya gizlenir. Örneğin, adlı Form2 bir forma ait olan adlı Form1formu göz önünde bulundurun. Kapalı veya simge durumuna küçültülmüşse Form1 , Form2 kapatılır veya gizlenir. Sahip olunan formlar da hiçbir zaman sahip formlarının arkasında görüntülenmez. Sahip formu seçildiğinde sahip formun arkasında görüntülenmemesi gereken pencereleri bulma ve değiştirme gibi pencereler için sahip olunan formları kullanabilirsiniz.

Uyarı

Form bir çok belgeli arabirim (MDI) üst formuysa, bu özellik şu anda açık olan MDI alt formları dışında görüntülenen tüm formları döndürür. MDI üst formunda açılan MDI alt formlarını almak için özelliğini kullanın MdiChildren .

Şunlara uygulanır

Ayrıca bkz.