Form.OwnedForms 속성

정의

이 폼에 소유된 모든 폼을 나타내는 Form 개체의 배열을 가져옵니다.

public:
 property cli::array <System::Windows::Forms::Form ^> ^ OwnedForms { cli::array <System::Windows::Forms::Form ^> ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Form[] OwnedForms { get; }
[<System.ComponentModel.Browsable(false)>]
member this.OwnedForms : System.Windows.Forms.Form[]
Public ReadOnly Property OwnedForms As Form()

속성 값

Form[]

이 폼에 소유된 폼을 나타내는 Form 배열입니다.

특성

예제

다음 예제에서는 소유자 양식에서 소유 하는 모든 폼을 OwnedForms 수정 하는 속성을 사용 하는 방법을 보여 줍니다. 예제의 첫 번째 메서드는 소유된 양식과 연결된 소유된 양식의 배열에 양식을 추가합니다. 두 번째 메서드는 모든 소유 양식을 반복하고 캡션을 변경합니다. 이 예제에서는 두 메서드가 모두 폼의 이벤트 또는 다른 메서드에 의해 호출되어야 합니다.

private:
   void AddMyOwnedForm()
   {
      // Create form to be owned.
      Form^ ownedForm = gcnew Form;

      // Set the text of the owned form.
      ownedForm->Text = String::Format( "Owned Form {0}", this->OwnedForms->Length );

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

      // Show the owned form.
      ownedForm->Show();
   }

   void ChangeOwnedFormText()
   {
      // Loop through all owned forms and change their text.
      for ( int x = 0; x < this->OwnedForms->Length; x++ )
      {
         this->OwnedForms[ x ]->Text = String::Format( "My Owned Form {0}", x );
      }
   }
private void AddMyOwnedForm()
{
   // Create form to be owned.
   Form ownedForm = new Form();
   // Set the text of the owned form.
   ownedForm.Text = "Owned Form " + this.OwnedForms.Length;
   // Add the form to the array of owned forms.
   this.AddOwnedForm(ownedForm);
   // Show the owned form.
   ownedForm.Show();
}

private void ChangeOwnedFormText()
{
   // Loop through all owned forms and change their text.
   for (int x = 0; x < this.OwnedForms.Length; x++)
   {
      this.OwnedForms[x].Text = "My Owned Form " + x.ToString();
   }
}
Private Sub AddMyOwnedForm()
   ' Create form to be owned.
   Dim ownedForm As New Form()
   ' Set the text of the owned form.
   ownedForm.Text = "Owned Form " + Me.OwnedForms.Length.ToString()
   ' Add the form to the array of owned forms.
   Me.AddOwnedForm(ownedForm)
   ' Show the owned form.
   ownedForm.Show()
End Sub


Private Sub ChangeOwnedFormText()
   Dim x As Integer
   ' Loop through all owned forms and change their text.
   For x = 0 To (Me.OwnedForms.Length) - 1
      Me.OwnedForms(x).Text = "My Owned Form " + x.ToString()
   Next x
End Sub

설명

이 속성은 이 양식이 소유한 모든 폼을 포함하는 배열을 반환합니다. 다른 양식이 소유한 양식을 만들려면 메서드를 호출합니다 AddOwnedForm . 소유자 양식에 할당된 양식은 메서드가 호출될 때까지 RemoveOwnedForm 소유된 상태로 유지됩니다. 소유자 양식에 대한 참조를 사용하여 속성을 설정 Owner 하여 다른 사용자가 소유한 양식을 만들 수도 있습니다.

양식이 다른 양식에서 소유하는 경우 소유자 양식으로 닫히거나 숨겨집니다. 예를 들어 이름이 지정된 Form2 양식이 소유한 폼 Form1을 생각해 보세요. 닫히거나 최소화된 Form2 경우 Form1 닫히거나 숨겨집니다. 소유 양식도 소유자 양식 뒤에 표시되지 않습니다. 소유자 양식을 선택할 때 소유자 양식 뒤에 표시되지 않아야 하는 창 찾기 및 바꾸기와 같은 창에 소유 양식을 사용할 수 있습니다.

참고

양식이 MDI(다중 문서 인터페이스) 부모 폼인 경우 이 속성은 현재 열려 있는 MDI 자식 양식을 제외하고 표시되는 모든 양식을 반환합니다. MDI 부모 폼에서 열린 MDI 자식 폼을 가져오려면 속성을 사용합니다 MdiChildren .

적용 대상

추가 정보