次の方法で共有


TabControl.Appearance プロパティ

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

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

構文

'宣言
<LocalizableAttribute(True)> _
Public Property Appearance As TabAppearance
'使用
Dim instance As TabControl
Dim value As TabAppearance

value = instance.Appearance

instance.Appearance = value
[LocalizableAttribute(true)] 
public TabAppearance Appearance { get; set; }
[LocalizableAttribute(true)] 
public:
property TabAppearance Appearance {
    TabAppearance get ();
    void set (TabAppearance value);
}
/** @property */
public TabAppearance get_Appearance ()

/** @property */
public void set_Appearance (TabAppearance value)
public function get Appearance () : TabAppearance

public function set Appearance (value : TabAppearance)

プロパティ値

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

例外

例外の種類 条件

InvalidEnumArgumentException

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

解説

Appearance プロパティを FlatButtons に設定した場合、Alignment プロパティが Top に設定されている場合だけ、指定どおりの外観で表示されます。それ以外の場合は、Appearance プロパティに Buttons 値が設定されたものとして表示されます。

注意

Appearance プロパティを Buttons に設定した場合は、ボタンが正しく表示されるように Alignment プロパティも Top に設定する必要があります。

使用例

2 つの TabPage オブジェクトのある TabControl を作成する例を次に示します。この例では、Appearance プロパティを Buttons に設定します。この場合、タブ ページのタブはボタンとして表示されます。

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

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
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());
    }
}
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 );
}
import System.Windows.Forms.*;

public class Form1 extends 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.set_Appearance(TabAppearance.Buttons);
        tabControl1.get_Controls().AddRange(new TabPage[] {tabPage1, tabPage2});
        get_Controls().Add(tabControl1);
    } //Form1

    public static void main(String[] args)
    {
        Application.Run(new Form1());
    } //main
} //Form1

プラットフォーム

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

TabControl クラス
TabControl メンバ
System.Windows.Forms 名前空間
TabControl.Alignment プロパティ
TabAppearance 列挙体