See Also: TabControl Members
A System.Windows.Forms.TabControl contains tab pages, which are represented by System.Windows.Forms.TabPage objects that you add through the TabControl.TabPages property. The order of tab pages in this collection reflects the order the tabs appear in the control.
The user can change the current System.Windows.Forms.TabPage by clicking one of the tabs in the control. You can also programmatically change the current System.Windows.Forms.TabPage by using one of the following System.Windows.Forms.TabControl properties:
In dnprdnext, you can also use one of the following methods:
In dnprdnlong, you can respond when the current tab changes by handling one of the following events:
The tabs in a System.Windows.Forms.TabControl are part of the System.Windows.Forms.TabControl, but not parts of the individual System.Windows.Forms.TabPage controls. Members of the System.Windows.Forms.TabPage class, such as the Control.ForeColor property, affect only the client rectangle of the tab page, but not the tabs. Additionally, the Control.Hide method of the System.Windows.Forms.TabPage will not hide the tab. To hide the tab, you must remove the System.Windows.Forms.TabPage control from the TabControl.TabPages collection.
In dnprdnlong, the tab is considered part of the tab page for determining when the Control.Enter and Control.Leave events of the System.Windows.Forms.TabPage occur. In earlier versions of the .NET Framework, the Control.Enter and Control.Leave events of the System.Windows.Forms.TabPage do not occur when focus enters or leaves a tab, but only when focus enters or leaves the client rectangle of the tab page.
The following events are not raised for the System.Windows.Forms.TabControl class unless there is at least one System.Windows.Forms.TabPage in the TabControl.TabPages collection: Control.Click, Control.DoubleClick, Control.MouseDown, Control.MouseUp, Control.MouseHover, Control.MouseEnter, Control.MouseLeave and Control.MouseMove. If there is at least one System.Windows.Forms.TabPage in the collection, and the user interacts with the tab control's header (where the System.Windows.Forms.TabPage names appear), the System.Windows.Forms.TabControl raises the appropriate event. However, if the user interaction is within the Control.ClientRectangle of the tab page, the System.Windows.Forms.TabPage raises the appropriate event.
Controls contained in a System.Windows.Forms.TabPage are not created until the tab page is shown, and any data bindings in these controls are not activated until the tab page is shown.
When visual styles are enabled, and the TabControl.Alignment property is set to a value other than TabAlignment.Top, the tab contents might not render correctly. To work around this issue, you can paint the tab contents yourself using owner drawing. For more information, see How to: Display Side-Aligned Tabs with TabControl.
When the TabControl.Alignment property is set to a value other than TabAlignment.Top and the TabControl.Appearance property is set to a value other than TabAppearance.Normal, the tab page contents might not render correctly.