TabStrip Class
Represents a tabstrip control.
[ToolboxBitmap(typeof(TabStrip))]
public class TabStrip : UIControl, IUIControl, IUIElement, ILogicalTreeNode, IDpiAwareElement, IDisposable, ICommandTarget, IWeakEventListener, IOrientedElement
- Inheritance:
- object MarshalByRefObject Component Control ScrollableControl UIControl object
- Implements:
- IUIControl IUIElement ILogicalTreeNode IDpiAwareElement IDisposable ICommandTarget IWeakEventListener IOrientedElement
Constructors
TabStrip()
Initializes an instance of the class.
public TabStrip()
Properties
AutoInternalDragDrop
Indicates whether to automatically allow internal drag/drop reordering of tabs.
public bool AutoInternalDragDrop { get; set; }
Property Value
- bool:
trueif automatic internal reordering of tabs is allowed; otherwise,false.
Remarks
If this property is set to true, no TabStripPageTabDragStart event is raised when a drag begins
since all drag-handling code is handled internally by the control.
AutoSelectTabOnDragOver
Indicates whether to automatically select a page when a drag operation is moved over the page's tab.
public bool AutoSelectTabOnDragOver { get; set; }
Property Value
- bool:
trueif a page should be automatically selected when a drag operation is moved over the page's tab; otherwise,false.
AutoSetFocusOnClick
Indicates whether to automatically set focus to the page when a page's tab is clicked.
public bool AutoSetFocusOnClick { get; set; }
Property Value
- bool:
trueif focus should be set when a page's tab is clicked; otherwise,false.
BorderSides
The Sides that the border appears on.
public Sides BorderSides { get; set; }
Property Value
Remarks
This is used with the renderer's TabStripPageMargin to know which sides to indent client bounds.
CloseButtonVisible
Indicates whether a close button is visible.
public bool CloseButtonVisible { get; set; }
Property Value
- bool:
trueif a close button is visible; otherwise,false.
CloseCommand
The Command that is used for a close button click.
CommandLinks
A CommandLinkCollection containing the command links associated with the object.
[Browsable(false)]
public CommandLinkCollection CommandLinks { get; }
Property Value
DefaultSize
Gets the default size of the control.
DisplayRectangle
Gets the rectangle that represents the virtual display area of the control.
public override Rectangle DisplayRectangle { get; }
Property Value
ForceUnselectedFont
Indicates whether to force the control to tab text using the unselected Font, even for selected tabs.
public bool ForceUnselectedFont { get; set; }
Property Value
ForwardCommandsTo
The ICommandTarget, if any, to forward commands to.
[Browsable(false)]
public ICommandTarget? ForwardCommandsTo { get; set; }
Property Value
ImageList
The ImageList used for page images.
KeyboardNavigationEnabled
Indicates whether Ctrl+Tab keyboard navigation is enabled for switching between pages.
public bool KeyboardNavigationEnabled { get; set; }
Property Value
- bool:
trueifCtrl+Tabkeyboard navigation is enabled for switching between pages; otherwise,false.
Remarks
If keyboard navigation is enabled, the Ctrl+Tab and Ctrl+Shift+Tab keys will switch between pages.
MaximumTabExtent
The maximum extent of a tab.
public int MaximumTabExtent { get; set; }
Property Value
Remarks
Specify -1 to apply no maximum extent.
MinimumTabExtent
The minimum extent of a tab.
public int MinimumTabExtent { get; set; }
Property Value
Remarks
Specify -1 to apply no minimum extent.
OptionsButtonVisible
Indicates whether an options button is visible.
public bool OptionsButtonVisible { get; set; }
Property Value
- bool:
trueif an options button is visible; otherwise,false.
OptionsCommand
The Command that is used for a options button click.
Orientation
The orientation of the tabs in the control.
PageValidationEnabled
Indicates whether the SelectedPage is validated before allowing a page change to occur.
public bool PageValidationEnabled { get; set; }
Property Value
- bool:
trueif the SelectedPage is validated before allowing a page change to occur; otherwise,false.
Pages
The TabStripPageCollection containing the pages in the control.
Renderer
The control-specific ITabStripRenderer used to render the control.
public ITabStripRenderer? Renderer { get; set; }
Property Value
Remarks
If this value is null, then the global renderer will be used instead.
RendererResolved
The ITabStripRenderer used to render the control.
[Browsable(false)]
public ITabStripRenderer RendererResolved { get; }
Property Value
Remarks
This property will return a global renderer if there is no control instance renderer override. The registered renderer type with the UIRendererManager for this property is ITabStripRenderer.
RightClickSelectsTab
Indicates whether a right-click on a tab selects the related page.
public bool RightClickSelectsTab { get; set; }
Property Value
- bool:
trueif a right-click on a tab selects the related page; otherwise,false.
ScrollBackwardCommand
The Command that is used for a scroll backward button click.
ScrollDelta
The number of pixels to scroll per step when a scroll button is pressed.
public int ScrollDelta { get; set; }
Property Value
Remarks
A higher number will scroll faster than a lower number.
ScrollForwardCommand
The Command that is used for a scroll forward button click.
SelectedIndex
The index of the selected item.
[Browsable(false)]
public int SelectedIndex { get; set; }
Property Value
- int:
If there are no items in the control, this property returns
-1.
Remarks
The index is zero-based.
SelectedPage
The TabStripPage that is currently selected.
SingleTabVisible
Indicates whether a tab should still be visible if there is only one TabStripPage in the tab strip.
public bool SingleTabVisible { get; set; }
Property Value
- bool:
trueif the tab should be visible; otherwise,false.
TabAlignment
A TabStripTabAlignment specifying the alignment of the tabs.
TabAscent
The ascent of a tab.
TabOverflowStyle
A TabStripTabOverflowStyle specifying how to handle tab overflow.
public TabStripTabOverflowStyle TabOverflowStyle { get; set; }
Property Value
TabsAlignNear
Indicates whether the tabs should align on the near side (left, top) of the tab container or on the far side (right, bottom).
public bool TabsAlignNear { get; set; }
Property Value
- bool:
trueif the tabs should align on the near side of the tab container; otherwise,false.
Methods
ArrangeOverride(Size)
Positions child elements and determines an arrange size.
protected override Size ArrangeOverride(Size finalSize)
| Parameter | Type | Description |
|---|---|---|
| finalSize | Size | The final area within the parent that this element should use to arrange itself and its children. |
Returns
- Size:
The actual size used.
Remarks
Element authors should override this method, call Arrange(Rectangle) on each visible child element and position each child element. It is required that a parent element calls Arrange(Rectangle) on each child or they won't be rendered.
CreateChildren()
Invoked when the collection of child elements is to be created.
protected override IList<ILogicalTreeNode> CreateChildren()
Returns
- IList<ILogicalTreeNode>:
The list that should be assigned to the Children property.
Remarks
By default, no child collection is created.
CreateControlsInstance()
Creates a new instance of the control collection for the control.
protected override Control.ControlCollection CreateControlsInstance()
Returns
- Control.ControlCollection:
A new instance of Control.ControlCollection assigned to the control.
Dispose(bool)
Releases the unmanaged resources used by the Control and its child controls and optionally releases the managed resources.
protected override void Dispose(bool disposing)
| Parameter | Type | Description |
|---|---|---|
| disposing | bool |
|
GetButtonForCommand(Command)
Returns the TabStripButton for the specified Command.
public TabStripButton? GetButtonForCommand(Command command)
| Parameter | Type | Description |
|---|---|---|
| command | Command | The Command to search for. |
Returns
GetSidesFromTabStripTabAlignment(TabStripTabAlignment)
The Sides value that corresponds to the specified TabStripTabAlignment.
public static Sides GetSidesFromTabStripTabAlignment(TabStripTabAlignment tabAlignment)
| Parameter | Type | Description |
|---|---|---|
| tabAlignment | TabStripTabAlignment | The TabStripTabAlignment to examine. |
Returns
HitTest(Point)
Hit tests to find the TabStripPage whose tab contains the specified coordinates.
public TabStripPage? HitTest(Point point)
| Parameter | Type | Description |
|---|---|---|
| point | Point | The Point to test. |
Returns
MeasureOverride(Graphics?, Size)
Measures the size in layout required for child elements and determines a size for the element itself.
protected override Size MeasureOverride(Graphics? g, Size availableSize)
| Parameter | Type | Description |
|---|---|---|
| g | Graphics | The Graphics object to use for measurement. |
| availableSize | Size | The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available. |
Returns
- Size:
The size that this element determines it needs during layout, based on its calculations of child element sizes.
Remarks
Element authors should override this method, call Measure(Graphics?, Size) on each visible child element and determine the total size required.
OnCommand(CommandEventArgs)
Raises the Command event.
protected virtual void OnCommand(CommandEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | CommandEventArgs | The event data. |
OnDragLeave(EventArgs)
Raises the DragLeave event.
protected override void OnDragLeave(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | An EventArgs that contains the event data. |
OnDragOver(DragEventArgs)
Raises the DragOver event.
protected override void OnDragOver(DragEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | DragEventArgs |
OnEnter(EventArgs)
Raises the Enter event.
protected override void OnEnter(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | An EventArgs that contains the event data. |
OnLeave(EventArgs)
Raises the Leave event.
protected override void OnLeave(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | An EventArgs that contains the event data. |
OnMouseLeave(EventArgs)
Raises the MouseLeave event.
protected override void OnMouseLeave(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | An EventArgs that contains the event data. |
OnMouseMove(MouseEventArgs)
Raises the MouseMove event.
protected override void OnMouseMove(MouseEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseEventArgs | A MouseEventArgs that contains the event data. |
OnMouseUp(MouseEventArgs)
Raises the MouseUp event.
protected override void OnMouseUp(MouseEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseEventArgs | A MouseEventArgs that contains the event data. |
OnRender(PaintEventArgs)
Renders the element.
protected override void OnRender(PaintEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | PaintEventArgs | The event data. |
OnReselect(TabStripPageEventArgs)
Raises the Reselect event.
protected virtual void OnReselect(TabStripPageEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TabStripPageEventArgs | The event data. |
OnSelectionChanged(TabStripPageEventArgs)
Raises the SelectionChanged event.
protected virtual void OnSelectionChanged(TabStripPageEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TabStripPageEventArgs | The event data. |
OnSelectionChanging(TabStripPageCancelEventArgs)
Raises the SelectionChanging event.
protected virtual void OnSelectionChanging(TabStripPageCancelEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TabStripPageCancelEventArgs | The event data. |
OnTabStripPageTabContextMenu(TabStripPageContextMenuEventArgs)
Raises the TabStripPageTabContextMenu event.
protected virtual void OnTabStripPageTabContextMenu(TabStripPageContextMenuEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TabStripPageContextMenuEventArgs | The event data. |
OnTabStripPageTabDoubleClick(TabStripPageEventArgs)
Raises the TabStripPageTabDoubleClick event.
protected virtual void OnTabStripPageTabDoubleClick(TabStripPageEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TabStripPageEventArgs | The event data. |
OnTabStripPageTabDragStart(TabStripPageEventArgs)
Raises the TabStripPageTabDragStart event.
protected virtual void OnTabStripPageTabDragStart(TabStripPageEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TabStripPageEventArgs | The event data. |
OnTabStripPageTabMoved(TabStripPageEventArgs)
Raises the TabStripPageTabMoved event.
protected virtual void OnTabStripPageTabMoved(TabStripPageEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TabStripPageEventArgs | The event data. |
OnTabStripPageTabToolTipDisplaying(TabStripPageEventArgs)
Raises the TabStripPageTabToolTipDisplaying event.
protected virtual void OnTabStripPageTabToolTipDisplaying(TabStripPageEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TabStripPageEventArgs | The event data. |
ProcessCmdKey(ref Message, Keys)
Processes a command key.
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
| Parameter | Type | Description |
|---|---|---|
| m | Message | |
| keyData | Keys | One of the Keys values that represents the key to process. |
Returns
- bool:
trueif the character was processed by the control; otherwise,false.
RaiseCommand(Command)
Raises the specified Command.
public virtual bool RaiseCommand(Command command)
| Parameter | Type | Description |
|---|---|---|
| command | Command | The Command to raise. |
Returns
ResetImageList()
Resets the ImageList property to its default value.
public virtual void ResetImageList()
SelectNext()
Selects the next TabStripPage, wrapping to the beginning if necessary.
public int SelectNext()
Returns
- int:
The index of the new selected TabStripPage.
Remarks
If the last TabStripPage is selected when this method is called, the control will select the first TabStripPage.
SelectNext(bool)
Selects the next TabStripPage, optionally wrapping to the beginning if necessary.
public int SelectNext(bool wrap)
| Parameter | Type | Description |
|---|---|---|
| wrap | bool | Indicates whether to wrap to the beginning if the last TabStripPage is selected. |
Returns
- int:
The index of the new selected TabStripPage.
Remarks
If the last TabStripPage is selected when this method is called, the control will select
the first TabStripPage if the wrap parameter is set to true.
SelectPrevious()
Selects the previous TabStripPage, wrapping to the end if necessary.
public int SelectPrevious()
Returns
- int:
The index of the new selected TabStripPage.
Remarks
If the first TabStripPage is selected when this method is called, the control will select the last TabStripPage.
SelectPrevious(bool)
Selects the previous TabStripPage, optionally wrapping to the end if necessary.
public int SelectPrevious(bool wrap)
| Parameter | Type | Description |
|---|---|---|
| wrap | bool | Indicates whether to wrap to the end if the first TabStripPage is selected. |
Returns
- int:
The index of the new selected TabStripPage.
Remarks
If the first TabStripPage is selected when this method is called, the control will select
the last TabStripPage if the wrap parameter is set to true.
ShouldSerializeImageList()
Indicates whether the ImageList property should be persisted.
public virtual bool ShouldSerializeImageList()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
Events
Command
Occurs when a Command is executed.
public event CommandEventHandler? Command
Event Type
Remarks
Each TabStripButton in the TabStrip is associated with a Command. Use this event to perform any processing that should occur when a TabStripButton click occurs.
Reselect
Occurs after a TabStripPage is reselected.
public event TabStripPageEventHandler? Reselect
Event Type
Remarks
Use this event to perform any processing that should occur after an TabStripPage is clicked after it has already been selected.
SelectionChanged
Occurs after the selection changes.
public event TabStripPageEventHandler? SelectionChanged
Event Type
Remarks
Use this event to perform any processing that should occur after the selection changes.
SelectionChanging
Occurs before the selection changes.
public event TabStripPageCancelEventHandler? SelectionChanging
Event Type
Remarks
Use this event to perform any processing that should occur before selection changes.
The TabStripPage property of the event arguments indicates the TabStripPage about to be selected.
The selection change may be cancelled by setting the Cancel property of the event arguments to true.
TabStripPageTabContextMenu
Occurs when a TabStripPage tab needs a context menu displayed.
public event TabStripPageContextMenuEventHandler? TabStripPageTabContextMenu
Event Type
TabStripPageTabDoubleClick
Occurs when a tab is double-clicked.
public event TabStripPageEventHandler? TabStripPageTabDoubleClick
Event Type
TabStripPageTabDragStart
Occurs when a tab is starting to be dragged.
TabStripPageTabMoved
Occurs after a tab drag is moved via end user dragging when AutoInternalDragDrop is true.
TabStripPageTabToolTipDisplaying
Occurs before a tool tip is displayed for a tab and gives an opportunity to update the tab's tool tip text.
public event TabStripPageEventHandler? TabStripPageTabToolTipDisplaying
Event Type
Inherited Members
- UIControl.AddPendingGraphicsInversion(Rectangle)
- UIControl.AddPendingScrollOperation(Rectangle, Orientation, int)
- UIControl.AddPendingScrollOperation(Rectangle, int, int)
- UIControl.AddToInvalidatedRegion()
- UIControl.AddToInvalidatedRegion(Rectangle)
- UIControl.Arrange(Rectangle)
- UIControl.ContainsLocation(Point)
- UIControl.DpiScaleChanged(SizeF)
- UIControl.GetCursor(Point)
- UIControl.HitTest(PointHitTestParameters, Func<IUIElement, PointHitTestParameters, bool>)
- UIControl.HitTestRecursive(PointHitTestParameters, Func<IUIElement, PointHitTestParameters, bool>)
- UIControl.Invalidate(InvalidationLevels, InvalidationTypes)
- UIControl.InvalidateArrange()
- UIControl.InvalidateMeasure()
- UIControl.Measure(Graphics, Size)
- UIControl.OnClick(EventArgs)
- UIControl.OnDoubleClick(EventArgs)
- UIControl.OnDpiChangedAfterParent(EventArgs)
- UIControl.OnHandleCreated(EventArgs)
- UIControl.OnLayout(LayoutEventArgs)
- UIControl.OnLocationChanged(EventArgs)
- UIControl.OnMouseCaptureChanged(EventArgs)
- UIControl.OnMouseDown(MouseEventArgs)
- UIControl.OnMouseEnter(EventArgs)
- UIControl.OnMouseHover(EventArgs)
- UIControl.OnMouseWheel(MouseEventArgs)
- UIControl.OnPaint(PaintEventArgs)
- UIControl.OnPaintBackground(PaintEventArgs)
- UIControl.OnParentChanged()
- UIControl.OnParentChanged(EventArgs)
- UIControl.OnRenderChildElements(PaintEventArgs)
- UIControl.OnResize(EventArgs)
- UIControl.OnRightToLeftChanged(EventArgs)
- UIControl.OnVisibleChanged(EventArgs)
- UIControl.Render(PaintEventArgs)
- UIControl.ResetDoubleBufferCanvas(bool)
- UIControl.ResumePainting()
- UIControl.SuspendPainting()
- UIControl.TransformToAncestor(IUIElement)
- UIControl.TransformToDescendant(IUIElement)
- UIControl.UpdateCursor()
- UIControl.UpdateCursor(Point)
- UIControl.UpdateLayout()
- UIControl.ActualHeight
- UIControl.ActualWidth
- UIControl.BackColor
- UIControl.BackgroundImage
- UIControl.CaptureMouseWhenPressed
- UIControl.ClipBounds
- UIControl.DesiredSize
- UIControl.DpiScaleFactor
- UIControl.Font
- UIControl.ForeColor
- UIControl.IsArrangeValid
- UIControl.IsMeasureValid
- UIControl.IsPaintValid
- UIControl.IsRightToLeft
- UIControl.LastMouseUpButton
- UIControl.PaintingSuspended
- UIControl.UseControlGraphicsForMeasure
- UIControl.UseExtendedDoubleBuffering
- MarshalByRefObject.GetLifetimeService()
- MarshalByRefObject.InitializeLifetimeService()
- MarshalByRefObject.MemberwiseClone(bool)
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()