Freigeben über


TabControl.ItemSize-Eigenschaft

Ruft die Größe der Registerkarten des Steuerelements ab oder legt diese fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
<LocalizableAttribute(True)> _
Public Property ItemSize As Size
'Usage
Dim instance As TabControl
Dim value As Size

value = instance.ItemSize

instance.ItemSize = value
[LocalizableAttribute(true)] 
public Size ItemSize { get; set; }
[LocalizableAttribute(true)] 
public:
property Size ItemSize {
    Size get ();
    void set (Size value);
}
/** @property */
public Size get_ItemSize ()

/** @property */
public void set_ItemSize (Size value)
public function get ItemSize () : Size

public function set ItemSize (value : Size)

Eigenschaftenwert

Eine Size, die die Größe der Registerkarten darstellt. Standardmäßig wird die Größe der Registerkarten automatisch an die Symbole und Bezeichnungen auf der Registerkarte angepasst.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentOutOfRangeException

Die Breite oder Höhe von Size ist kleiner als 0 (null).

Hinweise

Um die Width-Eigenschaft der ItemSize-Eigenschaft zu ändern, muss die SizeMode-Eigenschaft auf Fixed festgelegt werden.

Beispiel

Im folgenden Codebeispiel wird ein TabControl mit zwei TabPage-Objekten erstellt. Um die Maße der Registerkarten zu definieren, legen sie die ItemSize-Eigenschaft auf eine Size-Struktur fest. In diesem Beispiel definiert Size die Registerkarten mit einer Breite von 90  Pixel und einer Höhe von 50 Pixel. Sie können die Größe der Registerkarten nicht ändern, es sei denn, die SizeMode-Eigenschaft wird auf den Fixed-Wert festgelegt.

Verwenden Sie für dieses Beispiel den System.Drawing-Namespace und den System.Windows.Forms-Namespace.

Imports System.Drawing
Imports System.Windows.Forms

Public Class Form1
    Inherits Form
    Private tabControl1 As TabControl
    Private tabPage1 As TabPage
    Private tabPage2 As TabPage

    Public Sub New()
        Me.tabControl1 = New TabControl()
        Me.tabPage1 = New TabPage()
        Me.tabPage2 = New TabPage()

        ' Sizes the tabs of tabControl1.
        Me.tabControl1.ItemSize = New Size(90, 50)

        ' Makes the tab width definable. 
        Me.tabControl1.SizeMode = TabSizeMode.Fixed

        Me.tabControl1.Controls.AddRange(New Control() {tabPage1, tabPage2})
        Me.tabControl1.Location = New Point(35, 25)
        Me.tabControl1.Size = New Size(220, 220)

        Me.Size = New Size(300, 300)
        Me.Controls.Add(tabControl1)
    End Sub

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

public class Form1 : Form
{
    private TabControl tabControl1;
    private TabPage tabPage1;
    private TabPage tabPage2;

    public Form1()
    {
        this.tabControl1 = new TabControl();
        this.tabPage1 = new TabPage();
        this.tabPage2 = new TabPage();
        
        // Sizes the tabs of tabControl1.
        this.tabControl1.ItemSize = new Size(90, 50);

        // Makes the tab width definable. 
        this.tabControl1.SizeMode = TabSizeMode.Fixed;

        this.tabControl1.Controls.AddRange(new Control[] {
            tabPage1, tabPage2});
        this.tabControl1.Location = new Point(35, 25);
        this.tabControl1.Size = new Size(220, 220);

        this.Size = new Size(300, 300);
        this.Controls.Add(tabControl1);
    }

    static void Main() 
    {
        Application.Run(new Form1());
    }
}
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public Form
{
private:
   TabControl^ tabControl1;
   TabPage^ tabPage1;
   TabPage^ tabPage2;

public:
   Form1()
   {
      this->tabControl1 = gcnew TabControl;
      this->tabPage1 = gcnew TabPage;
      this->tabPage2 = gcnew TabPage;
      
      // Sizes the tabs of tabControl1.
      this->tabControl1->ItemSize = System::Drawing::Size( 90, 50 );
      
      // Makes the tab width definable. 
      this->tabControl1->SizeMode = TabSizeMode::Fixed;
      array<Control^>^tabControl1Controls = {tabPage1,tabPage2};
      this->tabControl1->Controls->AddRange( tabControl1Controls );
      this->tabControl1->Location = Point(35,25);
      this->tabControl1->Size = System::Drawing::Size( 220, 220 );
      this->Size = System::Drawing::Size( 300, 300 );
      this->Controls->Add( tabControl1 );
   }

};

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

public class Form1 extends Form
{
    private TabControl tabControl1;
    private TabPage tabPage1;
    private TabPage tabPage2;
   
    public Form1()
    {
        this.tabControl1 = new TabControl();
        this.tabPage1 = new TabPage();
        this.tabPage2 = new TabPage();
        // Sizes the tabs of tabControl1.
        this.tabControl1.set_ItemSize(new Size(90, 50));
      
        // Makes the tab width definable. 
        this.tabControl1.set_SizeMode(TabSizeMode.Fixed);
        this.tabControl1.get_Controls().
            AddRange(new Control[]{tabPage1, tabPage2});
        this.tabControl1.set_Location(new Point(35, 25));
        this.tabControl1.set_Size(new Size(220, 220));
        this.set_Size(new Size(300, 300));
        this.get_Controls().Add(tabControl1);
    } //Form1
   
    public static void main(String[] args)
    {
        Application.Run(new Form1());
    } //main
} //Form1

Plattformen

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

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

TabControl-Klasse
TabControl-Member
System.Windows.Forms-Namespace
Size