次の方法で共有


TabControl.Appearance プロパティ

定義

コントロールのタブの外観を取得または設定します。

public:
 property System::Windows::Forms::TabAppearance Appearance { System::Windows::Forms::TabAppearance get(); void set(System::Windows::Forms::TabAppearance value); };
public System.Windows.Forms.TabAppearance Appearance { get; set; }
member this.Appearance : System.Windows.Forms.TabAppearance with get, set
Public Property Appearance As TabAppearance

プロパティ値

TabAppearance値の 1 つ。 既定値は、Normal です。

例外

プロパティ値が有効な TabAppearance 値ではありません。

次のコード例では、2 つのTabPage オブジェクトを含むTabControlを作成します。 次の使用例は、 Appearance プロパティを Buttons に設定し、タブ ページのタブをボタンとして表示します。

using namespace System;
using namespace System::Windows::Forms;
public ref class Form1: public Form
{
public:
   Form1()
   {
      array<String^>^tabText = {"tabPage1","tabPage2"};
      TabControl^ tabControl1 = gcnew TabControl;
      TabPage^ tabPage1 = gcnew TabPage( tabText[ 0 ] );
      TabPage^ tabPage2 = gcnew TabPage( tabText[ 1 ] );
      
      // Sets the tabs to appear as buttons.
      tabControl1->Appearance = TabAppearance::Buttons;
      array<TabPage^>^tabPageArray = {tabPage1,tabPage2};
      tabControl1->Controls->AddRange( tabPageArray );
      Controls->Add( tabControl1 );
   }

};

int main()
{
   Application::Run( gcnew Form1 );
}
using System.Windows.Forms;

public class Form1 : Form
{
    public Form1()
    {
        string[] tabText = {"tabPage1", "tabPage2"};
        TabControl tabControl1 = new TabControl();
        TabPage tabPage1 = new TabPage(tabText[0]);
        TabPage tabPage2 = new TabPage(tabText[1]);

        // Sets the tabs to appear as buttons.
        tabControl1.Appearance = TabAppearance.Buttons;

        tabControl1.Controls.AddRange(new TabPage[] {tabPage1, tabPage2});
        Controls.Add(tabControl1);
    }

    static void Main()
    {
        Application.Run(new Form1());
    }
}
Imports System.Windows.Forms

Public Class Form1
    Inherits Form

    Public Sub New()
        Dim tabText As String() = {"tabPage1", "tabPage2"}
        Dim tabControl1 As New TabControl()
        Dim tabPage1 As New TabPage(tabText(0))
        Dim tabPage2 As New TabPage(tabText(1))

        ' Sets the tabs to appear as buttons.
        tabControl1.Appearance = TabAppearance.Buttons

        tabControl1.Controls.AddRange(New TabPage() {tabPage1, tabPage2})
        Controls.Add(tabControl1)
    End Sub

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

注釈

Appearance プロパティを FlatButtons に設定すると、Alignment プロパティが Top に設定されている場合にのみ表示されます。 それ以外の場合、 Appearance プロパティは、 Buttons 値に設定されているかのように表示されます。

Appearance プロパティを Buttons に設定する場合は、タブ ページの内容が正しく表示されるように、Alignment プロパティをTopに設定する必要もあります。

適用対象

こちらもご覧ください