TabPage.GetTabPageOfComponent メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TabPage.GetTabPageOfComponent メソッドの意味・解説 

TabPage.GetTabPageOfComponent メソッド

指定されオブジェクト格納されているタブ ページ取得します

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

Public Shared Function GetTabPageOfComponent
 ( _
    comp As Object _
) As TabPage
Dim comp As Object
Dim returnValue As TabPage

returnValue = TabPage.GetTabPageOfComponent(comp)
public static TabPage GetTabPageOfComponent
 (
    Object comp
)
public:
static TabPage^ GetTabPageOfComponent (
    Object^ comp
)
public static TabPage GetTabPageOfComponent
 (
    Object comp
)
public static function GetTabPageOfComponent
 (
    comp : Object
) : TabPage

パラメータ

comp

検索対象オブジェクト

戻り値
指定されオブジェクト格納されている TabPage。オブジェクトが見つからない場合null 参照 (Visual Basic では Nothing)。

使用例使用例

それぞれ1 つButton コンポーネントを含む、2 つTabPage オブジェクトのある TabControl を作成するコード例次に示します。この例では、パラメータ button2GetTabPageOfComponent メソッド渡されています。このメソッドは、button2含まれる TabPage取得します正しタブ ページ取得されたことを検証するために、SelectedIndex プロパティは、button2 を含む TabPage を、現在選択されているタブ ページ設定します

この例では、System.Drawing 名前空間System.Windows.Forms 名前空間使用します

Imports System.Drawing
Imports System.Windows.Forms

Public Class Form1
    Inherits System.Windows.Forms.Form
    Private tabControl1 As TabControl
    Private tabPage1 As TabPage
    Private tabPage2 As TabPage
    Private button1 As Button
    Private button2 As Button

    Private Sub InitializeMyTabs()
        tabControl1 = New System.Windows.Forms.TabControl()
        tabPage1 = New System.Windows.Forms.TabPage()
        tabPage2 = New System.Windows.Forms.TabPage()
        button1 = New System.Windows.Forms.Button()
        button2 = New System.Windows.Forms.Button()

        tabControl1.Controls.AddRange(New System.Windows.Forms.Control()
 {tabPage1, tabPage2})
        tabControl1.Location = New System.Drawing.Point(40, 24)
        tabControl1.Size = New System.Drawing.Size(216, 216)
        tabControl1.TabIndex = 0

        tabPage1.Controls.AddRange(New System.Windows.Forms.Control()
 {button1})
        tabPage1.TabIndex = 0
        tabPage2.Controls.AddRange(New System.Windows.Forms.Control()
 {button2})
        tabPage2.TabIndex = 1

        button1.Location = New System.Drawing.Point(64, 72)
        button2.Location = New System.Drawing.Point(64, 72)
        button2.Text = "button2"

        ClientSize = New System.Drawing.Size(292, 273)
        Controls.AddRange(New System.Windows.Forms.Control() {tabControl1})

        ' Gets the index of the TabPage containing button2.
        ' Selects the index of the TabPage containing button2. 
        tabControl1.SelectedIndex = TabPage.GetTabPageOfComponent(button2).TabIndex
    End Sub

    Public Sub New()
        InitializeMyTabs()
    End Sub

    Shared Sub Main()
        Application.Run(New Form1())
    End Sub
End Class
using System.Drawing;
using System.Windows.Forms;

public class Form1 : System.Windows.Forms.Form
{
    private TabControl tabControl1;
    private TabPage tabPage1;
    private TabPage tabPage2;
    private Button button1;
    private Button button2;

    private void InitializeMyTabs()
    {
        tabControl1 = new System.Windows.Forms.TabControl();
        tabPage1 = new System.Windows.Forms.TabPage();
        tabPage2 = new System.Windows.Forms.TabPage();
        button1 = new System.Windows.Forms.Button();
        button2 = new System.Windows.Forms.Button();

        tabControl1.Controls.AddRange(new System.Windows.Forms.Control[]
 {
            tabPage1,
            tabPage2});
        tabControl1.Location = new System.Drawing.Point(40, 24);
        tabControl1.Size = new System.Drawing.Size(216, 216);
        tabControl1.TabIndex = 0;

        tabPage1.Controls.AddRange(new System.Windows.Forms.Control[]
 {button1});
        tabPage1.TabIndex = 0;
        tabPage2.Controls.AddRange(new System.Windows.Forms.Control[]
 {button2});
        tabPage2.TabIndex = 1;

        button1.Location = new System.Drawing.Point(64, 72);
        button2.Location = new System.Drawing.Point(64, 72);
        button2.Text = "button2";

        ClientSize = new System.Drawing.Size(292, 273);
        Controls.AddRange(new System.Windows.Forms.Control[] {tabControl1});

        // Gets the index of the TabPage containing button2.
        // Selects the index of the TabPage containing button2. 
        tabControl1.SelectedIndex = (TabPage.GetTabPageOfComponent(button2)).TabIndex;
    }

    public Form1()
    {
        InitializeMyTabs();
    }

    static void Main() 
    {
        Application.Run(new Form1());
    }
}
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public
 System::Windows::Forms::Form
{
private:
   TabControl^ tabControl1;
   TabPage^ tabPage1;
   TabPage^ tabPage2;
   Button^ button1;
   Button^ button2;
   void InitializeMyTabs()
   {
      tabControl1 = gcnew System::Windows::Forms::TabControl;
      tabPage1 = gcnew System::Windows::Forms::TabPage;
      tabPage2 = gcnew System::Windows::Forms::TabPage;
      button1 = gcnew System::Windows::Forms::Button;
      button2 = gcnew System::Windows::Forms::Button;
      array<System::Windows::Forms::Control^>^tabControls = {tabPage1,tabPage2};
      tabControl1->Controls->AddRange( tabControls );
      tabControl1->Location = System::Drawing::Point( 40, 24 );
      tabControl1->Size = System::Drawing::Size( 216, 216 );
      tabControl1->TabIndex = 0;
      array<System::Windows::Forms::Control^>^tabPage1Controls = {button1};
      tabPage1->Controls->AddRange( tabPage1Controls );
      tabPage1->TabIndex = 0;
      array<System::Windows::Forms::Control^>^tabPage2Controls = {button2};
      tabPage2->Controls->AddRange( tabPage2Controls );
      tabPage2->TabIndex = 1;
      button1->Location = System::Drawing::Point( 64, 72 );
      button2->Location = System::Drawing::Point( 64, 72 );
      button2->Text = "button2";
      ClientSize = System::Drawing::Size( 292, 273 );
      array<System::Windows::Forms::Control^>^formControls = {tabControl1};
      Controls->AddRange( formControls );
      
      // Gets the index of the TabPage containing button2.
      // Selects the index of the TabPage containing button2.
      tabControl1->SelectedIndex = (TabPage::GetTabPageOfComponent( button2 ))->TabIndex;
   }


public:
   Form1()
   {
      InitializeMyTabs();
   }

};

int main()
{
   Application::Run( gcnew Form1 );
}

import System.Drawing.*;
import System.Windows.Forms.*;

public class Form1 extends System.Windows.Forms.Form
{
    private TabControl tabControl1;
    private TabPage tabPage1;
    private TabPage tabPage2;
    private Button button1;
    private Button button2;

    private void InitializeMyTabs()
    {
        tabControl1 = new System.Windows.Forms.TabControl();
        tabPage1 = new System.Windows.Forms.TabPage();
        tabPage2 = new System.Windows.Forms.TabPage();
        button1 = new System.Windows.Forms.Button();
        button2 = new System.Windows.Forms.Button();

        tabControl1.get_Controls().AddRange(new System.Windows.Forms.Control[]
            { tabPage1, tabPage2 });
        tabControl1.set_Location(new System.Drawing.Point(40,
 24));
        tabControl1.set_Size(new System.Drawing.Size(216, 216));
        tabControl1.set_TabIndex(0);
        tabPage1.get_Controls().AddRange(new System.Windows.Forms.Control[]
 {
            button1 });
        tabPage1.set_TabIndex(0);

        tabPage2.get_Controls().AddRange(new System.Windows.Forms.Control[]
 { 
            button2 });
        tabPage2.set_TabIndex(1);

        button1.set_Location(new System.Drawing.Point(64, 72));
        button2.set_Location(new System.Drawing.Point(64, 72));
        button2.set_Text("button2");

        set_ClientSize(new System.Drawing.Size(292, 273));
        get_Controls().AddRange(new System.Windows.Forms.Control[]
 { 
            tabControl1 });

        // Gets the index of the TabPage containing button2.
        // Selects the index of the TabPage containing button2. 
        tabControl1.set_SelectedIndex(TabPage.GetTabPageOfComponent(button2).
            get_TabIndex());
    } //InitializeMyTabs

    public Form1()
    {
        InitializeMyTabs();
    } //Form1

    public static void main(String[]
 args)
    {
        Application.Run(new Form1());
    } //main
} //Form1
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

TabPage.GetTabPageOfComponent メソッドのお隣キーワード
検索ランキング

   

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



TabPage.GetTabPageOfComponent メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS