次の方法で共有


TabControl.TabPageCollection.IsReadOnly プロパティ

コレクションが読み取り専用かどうかを示す値を取得します。

Public Overridable ReadOnly Property IsReadOnly As Boolean  _   Implements IList.IsReadOnly
[C#]
public virtual bool IsReadOnly {get;}
[C++]
public: __property virtual bool get_IsReadOnly();
[JScript]
public function get IsReadOnly() : Boolean;

プロパティ値

このプロパティは常に false を返します。

実装

IList.IsReadOnly

使用例

[Visual Basic, C#, C++] 2 つの TabPage を持つ TabControl を作成する例を次に示します。この例では、 tabControl1 コントロール コレクションを取得し、 IsReadOnly プロパティを使用して読み取り専用かどうかを確認しています。

[Visual Basic, C#, C++] この例では、 System.Drawing 名前空間と System.Windows.Forms 名前空間を使用します。

 
Imports System.Drawing
Imports System.Windows.Forms

Public Class Form1
    Inherits Form

    Public Sub New()
        Dim tabControl1 As New TabControl()
        Dim tabPage1 As New TabPage()
        Dim tabPage2 As New TabPage()
        Dim label1 As New Label()

        ' Determines if the tabControl1 controls collection is read-only.
        If tabControl1.TabPages.IsReadOnly = True Then
            label1.Text = "The tabControl1 controls collection is read-only."
        Else
            label1.Text = "The tabControl1 controls collection is not read-only."
        End If
        tabControl1.TabPages.AddRange(New TabPage() {tabPage1, tabPage2})
        tabControl1.Location = New Point(25, 75)
        tabControl1.Size = New Size(250, 200)

        label1.Location = New Point(25, 25)
        label1.Size = New Size(250, 25)

        Me.ClientSize = New Size(300, 300)
        Me.Controls.AddRange(New Control() {tabControl1, label1})
    End Sub

    Shared Sub Main()
        Application.Run(New Form1())
    End Sub
End Class

[C#] 
using System.Drawing;
using System.Windows.Forms;

public class Form1 : Form
{
    public Form1()
    {
        TabControl tabControl1 = new TabControl();
        TabPage tabPage1 = new TabPage();
        TabPage tabPage2 = new TabPage();
        Label label1 = new Label();

        // Determines if the tabControl1 controls collection is read-only.
        if (tabControl1.TabPages.IsReadOnly == true)
            label1.Text = "The tabControl1 controls collection is read-only.";
        else
            label1.Text = "The tabControl1 controls collection is not read-only.";

        tabControl1.TabPages.AddRange(new TabPage[] {tabPage1, tabPage2});
        tabControl1.Location = new Point(25, 75);
        tabControl1.Size = new Size(250, 200);

        label1.Location = new Point(25, 25);
        label1.Size = new Size(250, 25);

        this.ClientSize = new Size(300, 300);
        this.Controls.AddRange(new Control[] {tabControl1, label1});
    }

    static void Main() 
    {
        Application.Run(new Form1());
    }
}

[C++] 
using namespace System::Drawing;
using namespace System::Windows::Forms;

public __gc class Form1 : public Form {
public:
    Form1() {
        TabControl* tabControl1 = new TabControl();
        TabPage* tabPage1 = new TabPage();
        TabPage* tabPage2 = new TabPage();
        Label* label1 = new Label();

        // Determines if the tabControl1 controls collection is read-only.
        if (tabControl1->TabPages->IsReadOnly == true)
            label1->Text = S"The tabControl1 controls collection is read-only.";
        else
            label1->Text = S"The tabControl1 controls collection is not read-only.";

        TabPage* tabPages[] = {tabPage1, tabPage2};
        tabControl1->TabPages->AddRange(tabPages);
        tabControl1->Location = Point(25, 75);
        tabControl1->Size = System::Drawing::Size(250, 200);
        label1->Location = Point(25, 25);
        label1->Size = System::Drawing::Size(250, 25);
        this->ClientSize = System::Drawing::Size(300, 300);
        Control* formControls[] = {tabControl1, label1};
        this->Controls->AddRange(formControls);
    }
};

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

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

TabControl.TabPageCollection クラス | TabControl.TabPageCollection メンバ | System.Windows.Forms 名前空間