ContainerControl.ParentForm プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ContainerControl.ParentForm プロパティの意味・解説 

ContainerControl.ParentForm プロパティ

コンテナ コントロール割り当てられるフォーム取得します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

使用例使用例

Form1 および Form2 という 2 つフォーム作成する方法次のコード例示しますForm1 の IsMdiContainer プロパティtrue設定し、このフォームForm2 の MdiParent にします。次に、各フォーム上にボタン (button1) を作成します。親フォーム上のボタンクリックされると、イベント ハンドラは子フォーム表示します。子フォーム上のボタンクリックされると、イベント ハンドラは、その親フォームName プロパティ表示します両方フォームbutton1 イベント ハンドラ上書きするには、次の 2 つコード セグメント使用します

' The event handler on Form1.
Private Sub button1_Click(ByVal
 sender As Object, ByVal
 e As System.EventArgs) Handles Button1.Click
    ' Create an instance of Form2.
    Dim f2 As New Form1()
    ' Make this form the parent of f2.
    f2.MdiParent = Me
    ' Display the form.
    f2.Show()
End Sub 'button1_Click
// The event handler on Form1.
private void button1_Click(object sender, System.EventArgs
 e)
{
    // Create an instance of Form2.
    Form1 f2 = new Form1();
    // Make this form the parent of f2.
    f2.MdiParent = this;
    // Display the form.
    f2.Show();
}
   // The event handler on Form1.
private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      // Create an instance of Form2.
      Form1^ f2 = gcnew Form1;

      // Make this form the parent of f2.
      f2->MdiParent = this;

      // Display the form.
      f2->Show();
   }
// The event handler on Form1.
private void button1_Click(Object sender, System.EventArgs
 e)
{
    // Create an instance of Form2.
    Form1 f2 = new Form1();
    // Make this form the parent of f2.
    f2.set_MdiParent(this);
    // Display the form.
    f2.Show();
} //button1_Click
' The event handler on Form2.
Private Sub Button1_Click(ByVal
 sender As System.Object, ByVal e As
 System.EventArgs) Handles Button1.Click
    ' Get the Name property of the parent.
    Dim s As String = ParentForm.Name
    ' Display the name in a message box.
    MessageBox.Show("My parent is " + s + ".")
End Sub 'button1_Click
// The event handler on Form2.
private void button1_Click(object sender, System.EventArgs
 e)
{
    // Get the Name property of the Parent.
    string s = ParentForm.Name;
    // Display the name in a message box.
    MessageBox.Show("My Parent is " + s + ".");
}
   // The event handler on Form2.
private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      // Get the Name property of the Parent.
      String^ s = ParentForm->Name;

      // Display the name in a message box.
      MessageBox::Show( String::Concat( "My Parent is ", s, "."
 ) );
   }
// The event handler on Form2.
private void button1_Click(Object sender, System.EventArgs
 e)
{
    // Get the Name property of the Parent.
    String s = get_ParentForm().get_Name();
    // Display the name in a message box.
    MessageBox.Show("My Parent is " + s + ".");
} //button1_Click
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からContainerControl.ParentForm プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からContainerControl.ParentForm プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からContainerControl.ParentForm プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ContainerControl.ParentForm プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ContainerControl.ParentForm プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS