TabControl.SizeMode-Eigenschaft
Ruft ab oder legt fest, wie die Größe der Registerkarten des Steuerelements bestimmt wird.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Property SizeMode As TabSizeMode
'Usage
Dim instance As TabControl
Dim value As TabSizeMode
value = instance.SizeMode
instance.SizeMode = value
public TabSizeMode SizeMode { get; set; }
public:
property TabSizeMode SizeMode {
TabSizeMode get ();
void set (TabSizeMode value);
}
/** @property */
public TabSizeMode get_SizeMode ()
/** @property */
public void set_SizeMode (TabSizeMode value)
public function get SizeMode () : TabSizeMode
public function set SizeMode (value : TabSizeMode)
Eigenschaftenwert
Ein TabSizeMode-Wert. Der Standardwert ist Normal.
Ausnahmen
Ausnahmetyp | Bedingung |
---|---|
Der Eigenschaftenwert ist kein gültiger TabSizeMode-Wert. |
Beispiel
Im folgenden Codebeispiel wird ein TabControl mit fünf TabPage erstellt. In diesem Beispiel wird die SizeMode-Eigenschaft auf FillToRight festgelegt, sodass die Größe der Registerkarten so angepasst werden, dass jede Zeile die gesamte Breite von tabControl1
einnimmt.
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
Public Sub New()
Me.tabControl1 = New TabControl()
Dim tabPage1 As New TabPage()
Dim tabPage2 As New TabPage()
Dim tabPage3 As New TabPage()
Dim tabPage4 As New TabPage()
Dim tabPage5 As New TabPage()
' Sizes the tabs so that each row fills the entire width of tabControl1.
Me.tabControl1.SizeMode = TabSizeMode.FillToRight
Me.tabControl1.Multiline = True
Me.tabControl1.Padding = New Point(15, 5)
Me.tabControl1.Controls.AddRange(New Control() {tabPage1, tabPage2, tabPage3, tabPage4, tabPage5})
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;
public Form1()
{
this.tabControl1 = new TabControl();
TabPage tabPage1 = new TabPage();
TabPage tabPage2 = new TabPage();
TabPage tabPage3 = new TabPage();
TabPage tabPage4 = new TabPage();
TabPage tabPage5 = new TabPage();
TabPage[] tabPages = {tabPage1, tabPage2, tabPage3, tabPage4, tabPage5};
// Sizes the tabs so that each row fills the entire width of tabControl1.
this.tabControl1.SizeMode = TabSizeMode.FillToRight;
this.tabControl1.Multiline = true;
this.tabControl1.Padding = new Point(15, 5);
this.tabControl1.Controls.AddRange(new Control[] {
tabPage1, tabPage2, tabPage3, tabPage4, tabPage5});
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;
public:
Form1()
{
this->tabControl1 = gcnew TabControl;
TabPage^ tabPage1 = gcnew TabPage;
TabPage^ tabPage2 = gcnew TabPage;
TabPage^ tabPage3 = gcnew TabPage;
TabPage^ tabPage4 = gcnew TabPage;
TabPage^ tabPage5 = gcnew TabPage;
array<TabPage^>^tabPages = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5};
// Sizes the tabs so that each row fills the entire width of tabControl1.
this->tabControl1->SizeMode = TabSizeMode::FillToRight;
this->tabControl1->Multiline = true;
this->tabControl1->Padding = Point(15,5);
array<Control^>^temp0 = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5};
this->tabControl1->Controls->AddRange( temp0 );
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;
public Form1()
{
this.tabControl1 = new TabControl();
TabPage tabPage1 = new TabPage();
TabPage tabPage2 = new TabPage();
TabPage tabPage3 = new TabPage();
TabPage tabPage4 = new TabPage();
TabPage tabPage5 = new TabPage();
TabPage tabPages[] = { tabPage1, tabPage2, tabPage3, tabPage4,
tabPage5 };
// Sizes the tabs so that each row fills the entire width of
// tabControl1.
this.tabControl1.set_SizeMode(TabSizeMode.FillToRight);
this.tabControl1.set_Multiline(true);
this.tabControl1.set_Padding(new Point(15, 5));
this.tabControl1.get_Controls().AddRange(new Control[] { tabPage1,
tabPage2, tabPage3, tabPage4, tabPage5 });
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
TabSizeMode