HypernovaDesktop Components · docs
Binarymission
WinForms › Power Tab Strip › BinaryPowerTabStrip

BinaryPowerTabStrip

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.TabControls

A tab control that draws its own headers in one of six styles, shows one page per tab, and copes with more tabs than will fit – by wrapping them onto extra rows or by listing the rest in a drop-down menu.

public partial class BinaryPowerTabStrip : ContainerControl

Inherits from / implements: ContainerControl

Remarks

Use it where a window holds several documents, records or views and the user moves between them: open files in an editor, customer accounts in a CRM screen, reports in a dashboard.

Pages and selection

Each tab is a BinaryPowerTabPage, a panel holding the tab's controls and carrying its header text, image, tooltip and colours. Add pages with AddTab() or through TabPages (not Controls). The selected page (SelectedTabPage) is docked under the headers and the others are hidden, so nothing is re-parented when the selection changes. TabPageSelectionChanged reports selection changes, and also pages being added, removed or changed.

Closing and reordering

Each header draws a close button (EnableTabPageLevelCloseButtonRendering). A click raises TabPageClosing, which can cancel, then removes the page and raises TabPageClosed. With EnableDragAndDropOfTabPages on, users drag headers into a new order.

More tabs than fit

TabsOverflowMode chooses: OverflowMode.Menu (the default) keeps one row and adds a drop-down glyph listing every tab; OverflowMode.MultiLine wraps the headers onto as many rows as they need.

Appearance

TabRenderingStyle picks the header shape and colouring, from the Visual Studio 2008 look (the default) to RenderingStyle.Custom, whose gradients come from CustomStartColor and CustomEndColor or each page's own colours. Headers run along the top or the bottom (TabPagesRenderingLocation) and can cast drop shadows (ShouldDrawTabHeaderDropShadow). Sizes are in logical pixels (1/96 inch), scaled to the display.

Examples

A form showing open documents as tabs. Closing a tab with unsaved changes asks first, and the form's title follows the selected tab.

// In a form's constructor (using System.Windows.Forms and Binarymission.WinForms.Controls.TabControls).
var documents = new BinaryPowerTabStrip { Dock = DockStyle.Fill, TabPageHeaderWidth = 160, EnableDragAndDropOfTabPages = true };

foreach (string file in new[] { "Q3 forecast.xlsx", "Board minutes.docx", "Supplier contract.pdf" })
{
    var page = new BinaryPowerTabPage { Text = file, ToolTipText = "Finance share: " + file };
    var editor = new RichTextBox { Dock = DockStyle.Fill };
    editor.TextChanged += (sender, e) => page.TabPageContentIsDirty = true;
    page.Controls.Add(editor);
    documents.AddTab(page);
}

documents.TabPageSelectionChanged += e =>
{
    if (e.TabPageChangeType == TabPageChangeTriggerSource.SelectionChanged && e.TabPage != null)
        Text = e.TabPage.Text + " - Open documents";
};

documents.TabPageClosing += e =>
{
    e.Cancel = e.TabPage.TabPageContentIsDirty
        && MessageBox.Show(this, "Discard the changes to " + e.TabPage.Text + "?", "Close document",
                           MessageBoxButtons.YesNo) == DialogResult.No;
};

Controls.Add(documents);

See also

Members at a glance

Constructors
BinaryPowerTabStripCreates an empty tab strip, 300 by 250 pixels, in the Visual Studio 2008 style with menu overflow.
Properties
BorderStyleGets the border style, which is always BorderStyle.None; the strip draws its own border (DrawBorderAroundTabStrip).
ControlsGets the controls inside the strip, which are its pages. Use TabPages to add and remove tabs.
CustomEndColorGets or sets the colour the header fill ends at in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.
CustomStartColorGets or sets the colour the header fill starts from in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.
DragDropIndicatorColorGets or sets the colour of the bar that shows where a dragged header will land.
DrawBorderAroundTabStripGets or sets whether a one-pixel border is drawn round the whole strip.
DrawTabPageOnTopOfEachOtherGets or sets whether neighbouring headers overlap, each slanting over the one before it, with the selected header on top.
DropShadowColorGets or sets the colour of the strip's drop shadow.
DropShadowDepthGets or sets how far the strip's drop shadow reaches, which is also the width of the band it takes from the strip.
DropShadowOpacityGets or sets how dark the strip's drop shadow is at its strongest.
EmptySpaceLengthBeforeTheFirstTabPageGets or sets the space left before the first header of each row.
EnableAutomaticUpdateOfTabPagesHeaderSizeGets or sets whether the header height is recalculated to fit the tallest caption or image whenever the strip's font or a page's image changes.
EnableControlledLayoutRenderingGets or sets a layout option that the strip stores but does not act on.
EnableDragAndDropOfTabPagesGets or sets whether users can drag a tab header to a new position.
EnableTabPageLevelCloseButtonRenderingGets or sets whether each tab header draws its own close button.
ExtendedWindowsXPRenderingFirstColorGets or sets the colour of the thin outer line along the selected header's leading edge in the RenderingStyle.ExtendedWindowsXP style.
ExtendedWindowsXPRenderingSecondColorGets or sets the colour of the two-pixel inner line along the selected header's leading edge in the RenderingStyle.ExtendedWindowsXP style.
GapBetweenTabPagesGets or sets the space between two neighbouring headers, while TabPagesHaveGapBetweenThem is on.
HeaderFontGets or sets the font of the header text, and gives it to every page.
HeaderTextCloseButtonExtraGapGets or sets the extra width added to every header when the headers are auto-sized.
IsBackgroundTransparentGets or sets whether the strip's background, and its pages', is transparent.
KeepShowingTooltipEvenWhenMousePointerIsMovingGets or sets whether the tooltip follows the pointer from header to header, rather than appearing only when the pointer rests.
NewlyAddedPagesAreLocatedAtLeftCornerGets or sets a placement preference for new pages that the strip stores but does not use to place them.
OverflowMenuGlyphDrawnInEnlargedModeGets or sets whether the overflow glyph is drawn at OverflowMenuGlyphSize, or by your PowerTabStripElementsRenderer, rather than as the standard 16-pixel arrow.
OverflowMenuGlyphSizeGets or sets the size of the overflow glyph's box while OverflowMenuGlyphDrawnInEnlargedMode is on.
OverflowMenuLabelFontGets or sets the font of the overflow menu's title.
OverflowMenuLabelForeColorGets or sets the colour of the overflow menu's title.
OverflowMenuLabelMarginGets or sets the space round the overflow menu's title.
OverflowMenuLabelTextGets or sets the title shown at the top of the overflow menu, while OverflowMenuShouldRenderTitleLabel is on.
OverflowMenuShouldRenderTitleLabelGets or sets whether the overflow menu starts with a title above the list of tabs.
PagesCurrentlyDisplayedInActiveTabControlViewGets the tab headers drawn by the last paint, in the order they were drawn.
PowerTabStripElementsRendererGets or sets an object of your own that draws the overflow glyph, in place of the built-in drop-down arrow.
PreventInvalidationGets or sets whether changing a page's BinaryPowerTabPage.Text leaves the strip unpainted until this is turned off again.
RenderFullTextForTabPageHeaderGets or sets how a caption wider than TabPageHeaderWidth is shortened: in the middle, keeping its start and end, or at the end.
ReserveCloseButtonSpaceOnAllTabPagesGets or sets whether room for a close button is added to every header, or only to the headers that draw one.
SelectedPageHeaderTextIsRenderedBoldGets or sets whether the selected tab's header text is drawn in bold when SelectedTabPageHeaderFont is not set.
SelectedTabPageGets or sets the tab whose page is on show.
SelectedTabPageHeaderFontGets or sets the font of the selected tab's header text.
ShouldAutoSizeTabsGets or sets whether every header is given the same width – that of the widest.
ShouldDrawDropShadowGets or sets whether the strip casts a drop shadow along its bottom and right-hand edges.
ShouldDrawTabHeaderDropShadowGets or sets whether each tab header casts a soft drop shadow down and to the right, the selected header's falling over its neighbours.
ShouldDrawTabPageHeaderInMultiLinesGets or sets whether a header's text may run onto more than one line.
ShouldEnableControlDiagnosticsReportingGets or sets whether the strip writes a report of the headers on show to Trace when the pointer enters or leaves it.
ShouldReportCurrentlyDisplayedTabPagesListGets or sets whether each paint records the headers it drew in PagesCurrentlyDisplayedInActiveTabControlView.
ShouldRespectTabPageSetupOrderUponSelectedPageChangeGets or sets whether selecting a tab whose header is out of view keeps the tabs in their order.
ShouldUpdateUponParentMoveGets or sets whether the selected page is repainted at once whenever the form the strip is on is moved.
ShouldUpdateUponParentResizeGets or sets whether the selected page is repainted at once whenever the form the strip is on is resized.
ShowCloseWindowButtonGets or sets whether the strip-level close button, at the right-hand end of the headers, closes the selected tab when clicked.
ShowDragDropIndicatorGets or sets whether a header being dragged shows where it will land: a bar between two headers, with a caret at each end, in DragDropIndicatorColor.
ShowOverflowMenuGlyphGets or sets whether the overflow glyph – the drop-down that lists the tabs – is shown at the right-hand end of the headers.
ShowToolTipGets or sets whether a page's BinaryPowerTabPage.ToolTipText is shown when the pointer rests on its header.
SizeGets or sets the size of the strip, and lays the headers out again for the new size.
TabBottomOrientationCloseButtonPositionGets or sets whether a header's close button sits near its top or its bottom edge when the tabs run along the bottom of the strip.
TabHeaderDropShadowColorGets or sets the colour of the tab headers' drop shadows.
TabHeaderDropShadowDepthGets or sets how far each tab header's drop shadow reaches.
TabHeaderDropShadowOpacityGets or sets how dark the tab headers' drop shadows are at their strongest.
TabHeaderStringFormatGets or sets the text layout used to measure and draw the header captions.
TabPageBorderColorGets or sets the colour of the headers' outline and of the border round the strip.
TabPageCloseButtonMouseEnterColorGets or sets the colour a header's close-button cross turns while the pointer is over it.
TabPageCloseButtonRectangleBorderColorGets or sets the outline of the box drawn behind the strip-level close button while the pointer is over it.
TabPageCloseButtonRectangleFillColorGets or sets the fill of the box drawn behind the strip-level close button while the pointer is over it.
TabPageCurrentSelectionIndicatorEndColorGets or sets the colour the selected header's fill ends at in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.
TabPageCurrentSelectionIndicatorStartColorGets or sets the colour the selected header's fill starts from in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.
TabPageHeaderDrawingGradientOrientationGets or sets the direction of the header fill's gradient in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.
TabPageHeaderForeColorGets or sets the colour of the header text.
TabPageHeaderHeightGets or sets the height of a row of tab headers.
TabPageHeaderHorizontalPaddingGets or sets the room added to each header's width on top of its text – the space that frames the caption.
TabPageHeaderShowsSideBarGets or sets whether each header carries a coloured bar along its right-hand edge in the RenderingStyle.Custom style.
TabPageHeaderTextFontOverridesControlDefaultGets or sets whether the selected tab's header text is drawn in its page's own BinaryPowerTabPage.HeaderTextFont, like the other headers, rather than in the selected-tab font.
TabPageHeaderWidthGets or sets the widest a header's text may be; longer captions are shortened with an ellipsis.
TabPageSideBarFillColorGets or sets the colour of the side bar on each header, when TabPageHeaderShowsSideBar is on.
TabPagesGets the strip's pages, in tab order.
TabPagesCloseButtonColorGets or sets the colour of the cross on the close buttons.
TabPagesHaveGapBetweenThemGets or sets whether the headers are spaced apart by GapBetweenTabPages rather than drawn edge to edge.
TabPagesOverFlowMenuBackColorGets or sets the background of the overflow menu, including its image margin.
TabPagesOverFlowMenuBorderColorGets or sets the colour of the overflow menu's border and separators.
TabPagesOverFlowMenuDropDownColorGets or sets the colour of the overflow glyph – the bar and arrow the menu drops from – rather than of the menu itself.
TabPagesOverFlowMenuFontGets or sets the font of the overflow menu.
TabPagesOverFlowMenuForeColorGets or sets the colour of the overflow menu's text.
TabPagesOverFlowMenuGlyphActiveRectangleBorderColorGets or sets the outline of the box drawn behind the overflow glyph while the pointer is over it.
TabPagesOverFlowMenuGlyphActiveRectangleFillColorGets or sets the fill of the box drawn behind the overflow glyph while the pointer is over it.
TabPagesOverFlowMenuHighlightColorGets or sets the colour drawn behind, and round, the item the pointer is over in the overflow menu.
TabPagesOverFlowMenuHighlightTextColorGets or sets a text colour for the overflow menu's highlighted item, which the menu does not use.
TabPagesOverFlowMenuShowImageMarginGets or sets whether the overflow menu keeps the strip down its left-hand side where item images go.
TabPagesOverflowCalculationStrategyGets or sets how many auto-sized tabs the strip assumes fit on a row when it fills rows by counting tabs rather than measuring them.
TabPagesRenderingLocationGets or sets whether the tab headers run along the top or the bottom of the strip.
TabRenderingStyleGets or sets the shape and colouring of the tab headers.
TabsOverflowModeGets or sets what the strip does when the headers are wider than it is: keep one row and list the tabs in a drop-down menu, or wrap them onto extra rows.
ThemeBorderColorCanBeOverriddenGets or sets whether border colours you set are kept in the styles that otherwise set their own.
ToolTipConfigurationGets or sets how the tab headers' tooltips look and behave: their delays, colours, icon, title and style.
UseLegacyMultiLineRowPackingGets or sets whether the rows of headers in OverflowMode.MultiLine mode are filled by counting tabs rather than by measuring them.
UseTabCurrentSelectionIndicatorColorGets or sets whether the selected header is filled with the selection colours in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.
Methods
AddTabAdds a page as the last tab, without selecting it.
AddTabAdds a page as the last tab, and selects it if asked to.
AddTabAdds a page as the first or the last tab, and selects it if asked to.
DisposeReleases the strip's resources, disposing every page it holds, the overflow menu and the tooltip.
GetDisabledImageFromNormalMakes a grey copy of an image, as a disabled header draws its page's image when it has no BinaryPowerTabPage.DisabledImage.
GetTabPageByPointGets the tab whose header is at a point.
HitTestTells which part of the strip is at a point: a header, a header's close button, the overflow glyph, the strip-level close button, or none of them.
OnCreateControlStarts watching the form and containers around the strip, for a strip added to a form that already exists, then carries on as the base class does.
OnDoubleClickRaises TabPageDoubleClicked for a double-click on a header, and the Control.DoubleClick event for a double-click anywhere else.
OnFontChangedRaises the Control.FontChanged event, and recalculates the header height when EnableAutomaticUpdateOfTabPagesHeaderSize is on.
OnHandleCreatedRaises the Control.HandleCreated event, and starts watching the form and containers around the strip so the headers are laid out again when they resize.
OnHandleDestroyedStops watching the form and containers around the strip, then raises the Control.HandleDestroyed event.
OnKeyDownSelects the next tab when Ctrl+Tab reaches the strip, then raises the Control.KeyDown event.
OnLayoutRaises the Control.Layout event, and at run time works out again how many headers fit.
OnMouseCaptureChangedRaises the Control.MouseCaptureChanged event, and abandons a header drag whose capture was taken away while the button is still down – by a window activated from the keyboard, or a dialog - so nothing is dropped later and no bar is left behind.
OnMouseDownRaises the Control.MouseDown event, then acts on a left-button press: selects the tab under the pointer, opens the overflow menu, or closes a tab whose close button was pressed.
OnMouseEnterRaises the Control.MouseEnter event, and notes the header the pointer entered over, for its tooltip.
OnMouseHoverRaises the Control.MouseHover event, and shows the tooltip of the header under the pointer.
OnMouseLeaveRaises the Control.MouseLeave event, hides any tooltip and clears the highlights on the buttons.
OnMouseMoveRaises the Control.MouseMove event, then carries a header drag along, or updates the tooltips and the highlights on the close buttons and the overflow glyph.
OnMouseUpRaises the Control.MouseUp event, and drops a header being dragged at the place the drop bar shows.
OnPaintPaints the headers, the overflow glyph and any drop bar; the Control.Paint event is not raised.
OnParentBackColorChangedRaises the Control.ParentBackColorChanged event, and repaints the drop-shadow band, which shows the colour behind the strip.
OnParentChangedRaises the Control.ParentChanged event, and starts watching the strip's new form and containers when it is moved to another parent at run time.
OnResizeRaises the Control.Resize event, and resizes the page area to the room the headers leave.
OnSizeChangedRaises the Control.SizeChanged event, then works out again how many headers fit and lays them out for the new size.
OnSystemColorsChangedRaises the Control.SystemColorsChanged event and repaints the strip, whose default colours come from the system palette.
OnTabStyleRenderingStyleChangedRaises the TabStyleRenderingStyleChanged event.
RearrangeTabPageLocationMoves a page to a new position among the tabs.
RefreshLayoutLays the headers and the page area out again from scratch.
RemoveTabRemoves a page from the strip and selects a neighbouring tab.
ResetExternalDoes nothing. Calling it has no effect on the strip.
ResetInvalidateWorks out again how many headers fit, lays the strip out and repaints it.
SetBoundsCoreSets the strip's bounds with layout suspended on the strip and every control inside it, so the pages are laid out once for the new size.
ShouldSerializeFontTells the designer whether to write Control.Font into the designer file: only when it differs from the system's default font.
ShouldSerializeItemsPart of the designer's serialisation support; not for use from application code. Returns true when the strip has pages.
ShouldSerializeSelectedItemPart of the designer's serialisation support; not for use from application code. Always returns true.
WndProcProcesses the strip's window messages, reserving and painting the drop-shadow band when ShouldDrawDropShadow is on.
Events
TabElementsLayoutChangingOccurs just before the strip lays its headers out again.
TabPageClosedOccurs after the user has closed a tab with a close button and its page has been removed.
TabPageClosingOccurs when the user clicks a close button, before the page is removed; a handler can cancel.
TabPageDoubleClickedOccurs when the user double-clicks a tab header.
TabPageSelectionChangedOccurs when the selected tab changes, and also when a page is added, removed or changed.
TabStyleRenderingStyleChangedOccurs when OnTabStyleRenderingStyleChanged is called.

Constructors

BinaryPowerTabStrip

public BinaryPowerTabStrip()

Creates an empty tab strip, 300 by 250 pixels, in the Visual Studio 2008 style with menu overflow.

Remarks

The first page is selected when the strip first paints, unless one has been selected by then.

Properties

BorderStyle

public new BorderStyle BorderStyle

Gets the border style, which is always BorderStyle.None; the strip draws its own border (DrawBorderAroundTabStrip).

Controls

public new ControlCollection Controls

Gets the controls inside the strip, which are its pages. Use TabPages to add and remove tabs.

CustomEndColor

public Color CustomEndColor

Gets or sets the colour the header fill ends at in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.

Value
The default is Color.White.
Remarks

A page's own BinaryPowerTabPage.CustomEndColor, when set, takes precedence for that page.

See also

CustomStartColor

public Color CustomStartColor

Gets or sets the colour the header fill starts from in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.

Value
The default is a light orange, RGB (255, 192, 128).
Remarks

The fill runs to CustomEndColor in the direction of TabPageHeaderDrawingGradientOrientation. A page's own BinaryPowerTabPage.CustomStartColor, when set, takes precedence for that page. The selected header uses the selection colours instead while UseTabCurrentSelectionIndicatorColor is on.

DragDropIndicatorColor

public Color DragDropIndicatorColor

Gets or sets the colour of the bar that shows where a dragged header will land.

Value
The default is SystemColors.Highlight.

DrawBorderAroundTabStrip

public bool DrawBorderAroundTabStrip

Gets or sets whether a one-pixel border is drawn round the whole strip.

Value
The default is false.
Remarks

The border is drawn in TabPageBorderColor.

DrawTabPageOnTopOfEachOther

public bool DrawTabPageOnTopOfEachOther

Gets or sets whether neighbouring headers overlap, each slanting over the one before it, with the selected header on top.

Value
The default is false.
Remarks

Always on while TabRenderingStyle is RenderingStyle.TrapeziumTop; turning it off then has no effect.

DropShadowColor

public Color DropShadowColor

Gets or sets the colour of the strip's drop shadow.

Value
The default is Color.Black. The colour's alpha is ignored; DropShadowOpacity sets the strength.
Designer category
Appearance

DropShadowDepth

public int DropShadowDepth

Gets or sets how far the strip's drop shadow reaches, which is also the width of the band it takes from the strip.

Value
The distance in logical pixels, from 0 to 16; values outside that range are clamped. The default is 4.
Default
DropShadowPainter.DefaultDepth
Designer category
Appearance

DropShadowOpacity

public int DropShadowOpacity

Gets or sets how dark the strip's drop shadow is at its strongest.

Value
From 0 (no shadow) to 255; values outside that range are clamped. The default is 96.
Default
DropShadowPainter.DefaultOpacity
Designer category
Appearance

EmptySpaceLengthBeforeTheFirstTabPage

public int EmptySpaceLengthBeforeTheFirstTabPage

Gets or sets the space left before the first header of each row.

Value
The space in logical pixels. The default is 8.

EnableAutomaticUpdateOfTabPagesHeaderSize

public bool EnableAutomaticUpdateOfTabPagesHeaderSize

Gets or sets whether the header height is recalculated to fit the tallest caption or image whenever the strip's font or a page's image changes.

Value
The default is false.
Remarks

When on, a change to the strip's Control.Font, or to a page's BinaryPowerTabPage.Image or BinaryPowerTabPage.DisabledImage, sets TabPageHeaderHeight to the larger of the tallest image and the tallest caption (in the strip's font) plus a margin. Turning it on does not resize anything by itself. Either way the headers are never drawn shorter than their font and images need.

EnableControlledLayoutRendering

public bool EnableControlledLayoutRendering

Gets or sets a layout option that the strip stores but does not act on.

Value
The default is false; neither value changes layout or painting.

EnableDragAndDropOfTabPages

public bool EnableDragAndDropOfTabPages

Gets or sets whether users can drag a tab header to a new position.

Value
The default is false.
Remarks

A press becomes a drag once the held pointer moves past the system's drag distance. A bar marks where the header will land (ShowDragDropIndicator), and on release the page moves there in TabPages, raising TabPageSelectionChanged with TabPageChangeTriggerSource.Removed then TabPageChangeTriggerSource.Added. Turning this off cancels a drag in progress.

See also

EnableTabPageLevelCloseButtonRendering

public bool EnableTabPageLevelCloseButtonRendering

Gets or sets whether each tab header draws its own close button.

Value
The default is true.
Remarks

A button is drawn on a header whose page has both BinaryPowerTabPage.ShouldRenderCloseButton and BinaryPowerTabPage.IsHeaderEnabled on, and the header is widened by 20 logical pixels to make room (see ReserveCloseButtonSpaceOnAllTabPages). A click raises TabPageClosing; unless it is cancelled the page is removed and TabPageClosed is raised.

The buttons respond only while ShowCloseWindowButton is also on; with it off they are drawn but do nothing.

ExtendedWindowsXPRenderingFirstColor

public Color ExtendedWindowsXPRenderingFirstColor

Gets or sets the colour of the thin outer line along the selected header's leading edge in the RenderingStyle.ExtendedWindowsXP style.

Value
The default is Color.Blue.
Remarks

A two-pixel line in ExtendedWindowsXPRenderingSecondColor runs inside it. The colour is used from the next repaint.

ExtendedWindowsXPRenderingSecondColor

public Color ExtendedWindowsXPRenderingSecondColor

Gets or sets the colour of the two-pixel inner line along the selected header's leading edge in the RenderingStyle.ExtendedWindowsXP style.

Value
The default is Color.LightBlue. Used from the next repaint.

GapBetweenTabPages

public int GapBetweenTabPages

Gets or sets the space between two neighbouring headers, while TabPagesHaveGapBetweenThem is on.

Value
The space in logical pixels. The default is 8.
Default
8

HeaderFont

public Font HeaderFont

Gets or sets the font of the header text, and gives it to every page.

Value
The default is the system's default user-interface font. Setting null is ignored.
Remarks

Setting it replaces every page's BinaryPowerTabPage.HeaderTextFont, and a page added later is given it when it joins the strip; to give one tab its own font, set that page's font afterwards. The selected tab uses SelectedTabPageHeaderFont.

HeaderTextCloseButtonExtraGap

public int HeaderTextCloseButtonExtraGap

Gets or sets the extra width added to every header when the headers are auto-sized.

Value
The width in logical pixels. The default is 8.
Remarks

Used only while ShouldAutoSizeTabs is on; otherwise TabPageHeaderHorizontalPadding sets the room round each caption.

IsBackgroundTransparent

public bool IsBackgroundTransparent

Gets or sets whether the strip's background, and its pages', is transparent.

Value
The default is false.
Remarks

Turning it on remembers Control.BackColor and sets it to Color.Transparent; turning it off restores it. The setting is passed to the pages the strip has at the time, not to pages added later.

KeepShowingTooltipEvenWhenMousePointerIsMoving

public bool KeepShowingTooltipEvenWhenMousePointerIsMoving

Gets or sets whether the tooltip follows the pointer from header to header, rather than appearing only when the pointer rests.

Value
The default is false.
Remarks

When false, the tooltip appears when the pointer rests on the header it entered the strip over; moving onto another header hides it, and that header's tooltip appears only after the pointer has left the strip and come back.

When true, each movement over a header shows that header's tooltip at the pointer, and leaving the headers hides it.

NewlyAddedPagesAreLocatedAtLeftCorner

public bool NewlyAddedPagesAreLocatedAtLeftCorner

Gets or sets a placement preference for new pages that the strip stores but does not use to place them.

Value
The default is false.
Remarks

AddTab() and AddTab() add the page as the last tab whichever the value. To add a page as the first tab, use AddTab().

OverflowMenuGlyphDrawnInEnlargedMode

public bool OverflowMenuGlyphDrawnInEnlargedMode

Gets or sets whether the overflow glyph is drawn at OverflowMenuGlyphSize, or by your PowerTabStripElementsRenderer, rather than as the standard 16-pixel arrow.

Value
The default is false.
Remarks

While this is on, the strip-level close button (ShowCloseWindowButton) has no place; the close buttons on the headers are not affected.

OverflowMenuGlyphSize

public Size OverflowMenuGlyphSize

Gets or sets the size of the overflow glyph's box while OverflowMenuGlyphDrawnInEnlargedMode is on.

Value
The size in logical pixels. The default is 16 by 16.
Remarks

Without a PowerTabStripElementsRenderer, each side must be from 16 to 32; a size outside that range is replaced by 16 by 16. With a renderer, any size is kept; the check is made when the size is set, so set the renderer first. Out of enlarged mode the glyph is always 16 by 16.

OverflowMenuLabelFont

public Font OverflowMenuLabelFont

Gets or sets the font of the overflow menu's title.

Value
The default is null: the menu's own font.

OverflowMenuLabelForeColor

public Color OverflowMenuLabelForeColor

Gets or sets the colour of the overflow menu's title.

Value
The default is Color.Empty: the menu's own text colour.

OverflowMenuLabelMargin

public Padding OverflowMenuLabelMargin

Gets or sets the space round the overflow menu's title.

Value
The margin in pixels. The default is no margin on any side.

OverflowMenuLabelText

public string OverflowMenuLabelText

Gets or sets the title shown at the top of the overflow menu, while OverflowMenuShouldRenderTitleLabel is on.

Value
The default is null: an empty title.

OverflowMenuShouldRenderTitleLabel

public bool OverflowMenuShouldRenderTitleLabel

Gets or sets whether the overflow menu starts with a title above the list of tabs.

Value
The default is false.
Remarks
Example
tabs.OverflowMenuShouldRenderTitleLabel = true;
tabs.OverflowMenuLabelText = "Open documents";
tabs.OverflowMenuLabelFont = new Font("Segoe UI", 9f, FontStyle.Bold);
tabs.OverflowMenuLabelMargin = new Padding(4, 4, 4, 2);

PagesCurrentlyDisplayedInActiveTabControlView

public IEnumerable<CurrentlyDisplayedTabPagesListReport> PagesCurrentlyDisplayedInActiveTabControlView

Gets the tab headers drawn by the last paint, in the order they were drawn.

Value
One entry per header drawn; empty unless ShouldReportCurrentlyDisplayedTabPagesList is on. The same list is cleared and refilled by every paint, so copy it to keep a snapshot.

PowerTabStripElementsRenderer

public IPowerTabStripElementsRenderer PowerTabStripElementsRenderer

Gets or sets an object of your own that draws the overflow glyph, in place of the built-in drop-down arrow.

Value
The renderer, or null (the default) for the built-in glyph.
Remarks

The renderer is called only while OverflowMenuGlyphDrawnInEnlargedMode is on. It draws into a box OverflowMenuGlyphSize in size at the right-hand end of the headers, and is told whether the pointer is over it (OverflowMenuGlyphVisualState). With a renderer set, OverflowMenuGlyphSize is not limited to 16 to 32 pixels – set the renderer first, then the size – so make TabPageHeaderHeight at least as tall as the glyph.

While a renderer is set, the strip-level close button (ShowCloseWindowButton) has no place.

Example
public sealed class TabListGlyph : IPowerTabStripElementsRenderer
{
    public void RenderOverflowMenuGraphic(Graphics g, Rectangle bounds, OverflowMenuGlyphVisualState state)
    {
        Color back = state == OverflowMenuGlyphVisualState.Highlighted ? Color.FromArgb(204, 228, 247) : Color.Transparent;
        using (var fill = new SolidBrush(back))
        {
            g.FillRectangle(fill, bounds);
        }

        TextRenderer.DrawText(g, "All tabs", SystemFonts.MenuFont, bounds, SystemColors.ControlText,
                              TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
    }
}

tabs.OverflowMenuGlyphDrawnInEnlargedMode = true;
tabs.PowerTabStripElementsRenderer = new TabListGlyph();
tabs.OverflowMenuGlyphSize = new Size(72, 24);
tabs.TabPageHeaderHeight = 28;

PreventInvalidation

public bool PreventInvalidation

Gets or sets whether changing a page's BinaryPowerTabPage.Text leaves the strip unpainted until this is turned off again.

Value
The default is false.
Remarks

Set it before renaming many tabs and clear it afterwards; clearing it repaints once. Only text changes are held back.

RenderFullTextForTabPageHeader

public bool RenderFullTextForTabPageHeader

Gets or sets how a caption wider than TabPageHeaderWidth is shortened: in the middle, keeping its start and end, or at the end.

Value
false (the default) to remove the middle of the caption and put an ellipsis there, so "Quarterly sales forecast.xlsx" keeps both its first words and its file extension; true to keep the caption from its start and cut it at the end.
Remarks

Either way the text is no wider than TabPageHeaderWidth; raise that to show long captions in full. The new value is used from the strip's next repaint.

ReserveCloseButtonSpaceOnAllTabPages

public bool ReserveCloseButtonSpaceOnAllTabPages

Gets or sets whether room for a close button is added to every header, or only to the headers that draw one.

Value
The default is true: every header is widened.
Remarks

While EnableTabPageLevelCloseButtonRendering is on, 20 logical pixels are added to a header for its close button. A button is drawn only on a page whose BinaryPowerTabPage.ShouldRenderCloseButton and BinaryPowerTabPage.IsHeaderEnabled are on, so set this to false when some pages turn their button off and should not carry the empty room.

Auto-sized headers (ShouldAutoSizeTabs) stay uniform: they all get the room if any page draws a button.

SelectedPageHeaderTextIsRenderedBold

public bool SelectedPageHeaderTextIsRenderedBold

Gets or sets whether the selected tab's header text is drawn in bold when SelectedTabPageHeaderFont is not set.

Value
The default is true.
Remarks

Set SelectedTabPageHeaderFont for any other look. Not shown in the designer's property grid.

SelectedTabPage

public BinaryPowerTabPage SelectedTabPage

Gets or sets the tab whose page is on show.

Value
The selected page, or null when there is none.
Default
null
Remarks

Setting it shows that page, hides the others and raises TabPageSelectionChanged. Setting null selects the first page instead, if it is BinaryPowerTabPage.Visible.

In OverflowMode.Menu mode, selecting a page whose header is not on show moves the page to the front of TabPages so its header comes into view – unless ShouldRespectTabPageSetupOrderUponSelectedPageChange is on.

SelectedTabPageHeaderFont

public Font SelectedTabPageHeaderFont

Gets or sets the font of the selected tab's header text.

Value
The font, or null (the default) to derive it; the getter then returns HeaderFont in bold.
Remarks

Left unset, the selected header uses the page's own BinaryPowerTabPage.HeaderTextFont, in bold while SelectedPageHeaderTextIsRenderedBold is on. Not used while TabPageHeaderTextFontOverridesControlDefault is on. The header height grows, if it must, to fit this font.

ShouldAutoSizeTabs

public bool ShouldAutoSizeTabs

Gets or sets whether every header is given the same width – that of the widest.

Value
The default is false: each header is as wide as its own caption.
Remarks

When on, each header is as wide as the widest caption and image, plus HeaderTextCloseButtonExtraGap, the close button's room and 20 logical pixels. TabPageHeaderHorizontalPadding does not apply.

ShouldDrawDropShadow

public bool ShouldDrawDropShadow

Gets or sets whether the strip casts a drop shadow along its bottom and right-hand edges.

Value
The default is false.
Default
false
Designer category
Appearance
Remarks

A child control cannot paint outside itself, so the shadow is drawn in a band inside the strip's bounds, and the room for the headers and pages shrinks by DropShadowDepth on those two edges. The part of the band the shadow does not cover is filled with the colour of the nearest opaque container behind the strip.

See also

ShouldDrawTabHeaderDropShadow

public bool ShouldDrawTabHeaderDropShadow

Gets or sets whether each tab header casts a soft drop shadow down and to the right, the selected header's falling over its neighbours.

Value
The default is false.
Default
false
Designer category
Appearance
Remarks

Each shadow follows its header's own outline. When the headers overlap (DrawTabPageOnTopOfEachOther, always the case with RenderingStyle.TrapeziumTop), only the selected header casts one.

Separate from ShouldDrawDropShadow, which shadows the whole strip; either, both or neither may be on.

Example
tabs.ShouldDrawTabHeaderDropShadow = true;
tabs.TabHeaderDropShadowDepth = 4;
tabs.TabHeaderDropShadowOpacity = 60;

ShouldDrawTabPageHeaderInMultiLines

public bool ShouldDrawTabPageHeaderInMultiLines

Gets or sets whether a header's text may run onto more than one line.

Value
The default is false: each caption is drawn on one line.
Remarks

When on, line breaking is left to TabHeaderStringFormat, so a caption wider than TabPageHeaderWidth can wrap; make TabPageHeaderHeight tall enough to show the extra lines.

ShouldEnableControlDiagnosticsReporting

public bool ShouldEnableControlDiagnosticsReporting

Gets or sets whether the strip writes a report of the headers on show to Trace when the pointer enters or leaves it.

Value
The default is false. Reports only while ShouldReportCurrentlyDisplayedTabPagesList is also on.

ShouldReportCurrentlyDisplayedTabPagesList

public bool ShouldReportCurrentlyDisplayedTabPagesList

Gets or sets whether each paint records the headers it drew in PagesCurrentlyDisplayedInActiveTabControlView.

Value
The default is false. A diagnostic aid, hidden from the designer.

ShouldRespectTabPageSetupOrderUponSelectedPageChange

public bool ShouldRespectTabPageSetupOrderUponSelectedPageChange

Gets or sets whether selecting a tab whose header is out of view keeps the tabs in their order.

Value
The default is false.
Remarks

Applies in OverflowMode.Menu mode, when a page is chosen from the overflow menu or set as SelectedTabPage while its header is not on show.

  • false – the page is moved to the front of TabPages, so its header becomes the first one shown.
  • true – the order is kept, and the headers on show shift along so the selected one is the last in view.

ShouldUpdateUponParentMove

public bool ShouldUpdateUponParentMove

Gets or sets whether the selected page is repainted at once whenever the form the strip is on is moved.

Value
The default is false.

ShouldUpdateUponParentResize

public bool ShouldUpdateUponParentResize

Gets or sets whether the selected page is repainted at once whenever the form the strip is on is resized.

Value
The default is false.
Remarks

The headers are laid out again after a resize either way; this also repaints the page's contents straight away, for pages whose controls draw themselves from the page's size.

ShowCloseWindowButton

public bool ShowCloseWindowButton

Gets or sets whether the strip-level close button, at the right-hand end of the headers, closes the selected tab when clicked.

Value
The default is true.
Default
true
Remarks

The button occupies a 16-logical-pixel square to the right of the overflow glyph, and has no place while OverflowMenuGlyphDrawnInEnlargedMode is on or a PowerTabStripElementsRenderer is set. It is drawn only in the designer; at run time a click on its place still closes the tab. The close buttons on the headers also respond only while this is on.

ShowDragDropIndicator

public bool ShowDragDropIndicator

Gets or sets whether a header being dragged shows where it will land: a bar between two headers, with a caret at each end, in DragDropIndicatorColor.

Value
The default is true.
Default
true
Remarks

The bar is shown only where a drop would move the page; outside the headers the pointer shows that a drop does nothing.

ShowOverflowMenuGlyph

public bool ShowOverflowMenuGlyph

Gets or sets whether the overflow glyph – the drop-down that lists the tabs – is shown at the right-hand end of the headers.

Value
The default is true.
Default
true
Remarks

Used in OverflowMode.Menu mode. With this off, headers that do not fit cannot be reached with the mouse.

ShowToolTip

public bool ShowToolTip

Gets or sets whether a page's BinaryPowerTabPage.ToolTipText is shown when the pointer rests on its header.

Value
The default is true.
See also

Size

public new Size Size

Gets or sets the size of the strip, and lays the headers out again for the new size.

Value
The size in pixels. The default is 300 by 250.
Default
300,250

TabBottomOrientationCloseButtonPosition

public CloseButtonPosition TabBottomOrientationCloseButtonPosition

Gets or sets whether a header's close button sits near its top or its bottom edge when the tabs run along the bottom of the strip.

Value
The default is CloseButtonPosition.Bottom.
Remarks

TabHeaderDropShadowColor

public Color TabHeaderDropShadowColor

Gets or sets the colour of the tab headers' drop shadows.

Value
The default is Color.Black. The colour's alpha is ignored; TabHeaderDropShadowOpacity sets the strength.
Default
Black
Designer category
Appearance

TabHeaderDropShadowDepth

public int TabHeaderDropShadowDepth

Gets or sets how far each tab header's drop shadow reaches.

Value
The distance in logical pixels, from 0 to 16; values outside that range are clamped. The default is 3. At 0 no shadow is drawn.
Default
3
Designer category
Appearance

TabHeaderDropShadowOpacity

public int TabHeaderDropShadowOpacity

Gets or sets how dark the tab headers' drop shadows are at their strongest.

Value
From 0 (no shadow) to 255 (solid TabHeaderDropShadowColor); values outside that range are clamped. The default is 80.
Default
80
Designer category
Appearance

TabHeaderStringFormat

public StringFormat TabHeaderStringFormat

Gets or sets the text layout used to measure and draw the header captions.

Value
The default centres the caption both ways.
Remarks

The strip adjusts the format's trimming and line-breaking flags as it lays out and paints (see RenderFullTextForTabPageHeader and ShouldDrawTabPageHeaderInMultiLines), and disposes the format it holds when it is disposed, so give it a format of its own rather than one shared with other code. The new format is used from the next repaint.

TabPageBorderColor

public Color TabPageBorderColor

Gets or sets the colour of the headers' outline and of the border round the strip.

Value
The default is SystemColors.ControlDark.
Remarks

In the RenderingStyle.VisualStudio2008 style the strip sets this colour itself as it paints, unless ThemeBorderColorCanBeOverridden is on; turn that on to keep a colour of your own. The new colour is used from the next repaint.

See also

TabPageCloseButtonMouseEnterColor

public Color TabPageCloseButtonMouseEnterColor

Gets or sets the colour a header's close-button cross turns while the pointer is over it.

Value
The default is Color.Red.
See also

TabPageCloseButtonRectangleBorderColor

public Color TabPageCloseButtonRectangleBorderColor

Gets or sets the outline of the box drawn behind the strip-level close button while the pointer is over it.

Value
The default is SystemColors.Highlight.
See also

TabPageCloseButtonRectangleFillColor

public Color TabPageCloseButtonRectangleFillColor

Gets or sets the fill of the box drawn behind the strip-level close button while the pointer is over it.

Value
The default is SystemColors.Highlight.
Remarks

The close buttons on the headers do not draw this box.

See also

TabPageCurrentSelectionIndicatorEndColor

public Color TabPageCurrentSelectionIndicatorEndColor

Gets or sets the colour the selected header's fill ends at in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.

Value
The default is Color.White.

TabPageCurrentSelectionIndicatorStartColor

public Color TabPageCurrentSelectionIndicatorStartColor

Gets or sets the colour the selected header's fill starts from in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.

Value
The default is Color.Orange.
Remarks

TabPageHeaderDrawingGradientOrientation

public LinearGradientMode TabPageHeaderDrawingGradientOrientation

Gets or sets the direction of the header fill's gradient in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.

Value
The default is Vertical: from the top of the header to the bottom.

TabPageHeaderForeColor

public Color TabPageHeaderForeColor

Gets or sets the colour of the header text.

Value
The default is SystemColors.WindowText.
Remarks

A page's own BinaryPowerTabPage.TabPageHeaderForeColor, when set, takes precedence. The text of an unselected header whose page has BinaryPowerTabPage.IsHeaderEnabled off is drawn in SystemColors.GrayText.

TabPageHeaderHeight

public int TabPageHeaderHeight

Gets or sets the height of a row of tab headers.

Value
The height in logical pixels. The default is 24.
Remarks

The headers are never drawn shorter than their text needs – the selected tab's font height plus 11 logical pixels – nor than the tallest page image needs, so a larger font or image makes them taller without this value changing. A value larger than both is used as it is.

The page area starts below the headers (above them when TabPagesRenderingLocation is TabPagesRenderingLocation.Bottom), and in OverflowMode.MultiLine mode each row of headers takes this height. Unless TabPageHeaderHorizontalPadding is set, each header is also this much wider than its text.

Example
// Taller headers for a touch-friendly screen.
tabs.TabPageHeaderHeight = 36;
See also

TabPageHeaderHorizontalPadding

public int TabPageHeaderHorizontalPadding

Gets or sets the room added to each header's width on top of its text – the space that frames the caption.

Value
The padding in logical pixels, or -1 (the default) to use the header height (TabPageHeaderHeight). Any negative value is stored as -1.
Remarks

Lower it to make every tab narrower without changing the font, so more headers fit before the overflow menu is needed.

Applies while ShouldAutoSizeTabs is off. Auto-sized tabs all take the width of the widest, and HeaderTextCloseButtonExtraGap sets their extra room instead.

Example
// Compact tabs: 12 logical pixels round each caption instead of the header height.
tabs.TabPageHeaderHorizontalPadding = 12;

TabPageHeaderShowsSideBar

public bool TabPageHeaderShowsSideBar

Gets or sets whether each header carries a coloured bar along its right-hand edge in the RenderingStyle.Custom style.

Value
The default is false.
Remarks

Drawn only in RenderingStyle.Custom with the tabs along the top, in the page's BinaryPowerTabPage.TabPageSideBarFillColor when set and otherwise the strip's TabPageSideBarFillColor. A value set while TabPagesRenderingLocation is TabPagesRenderingLocation.Bottom is ignored, so set the location first.

TabPageHeaderTextFontOverridesControlDefault

public bool TabPageHeaderTextFontOverridesControlDefault

Gets or sets whether the selected tab's header text is drawn in its page's own BinaryPowerTabPage.HeaderTextFont, like the other headers, rather than in the selected-tab font.

Value
The default is false: the selected tab uses SelectedTabPageHeaderFont, which is bold unless set otherwise.
Remarks

With this on, SelectedTabPageHeaderFont and SelectedPageHeaderTextIsRenderedBold are not used. The new value is used from the strip's next repaint.

TabPageHeaderWidth

public int TabPageHeaderWidth

Gets or sets the widest a header's text may be; longer captions are shortened with an ellipsis.

Value
The width in logical pixels. The default is 200.
Remarks

A header is as wide as its text up to this width, plus its padding, image and close button. How a longer caption is shortened depends on RenderFullTextForTabPageHeader.

Changing it lays the headers out again at once.

See also

TabPageSideBarFillColor

public Color TabPageSideBarFillColor

Gets or sets the colour of the side bar on each header, when TabPageHeaderShowsSideBar is on.

Value
The default is orange, RGB (255, 128, 0).
Remarks

A page's own BinaryPowerTabPage.TabPageSideBarFillColor, when set, takes precedence for that page.

TabPages

public BinaryPowerTabPageCollection TabPages

Gets the strip's pages, in tab order.

Value
The collection of pages; never null. Adding or removing a page adds or removes its tab.

TabPagesCloseButtonColor

public Color TabPagesCloseButtonColor

Gets or sets the colour of the cross on the close buttons.

Value
The default is SystemColors.WindowText; SystemColors.GrayText is used while the strip has no pages.
See also

TabPagesHaveGapBetweenThem

public bool TabPagesHaveGapBetweenThem

Gets or sets whether the headers are spaced apart by GapBetweenTabPages rather than drawn edge to edge.

Value
The default is false.

TabPagesOverFlowMenuBackColor

public Color TabPagesOverFlowMenuBackColor

Gets or sets the background of the overflow menu, including its image margin.

Value
The default is Color.Empty: the standard menu background.
Designer category
Appearance
Example
// A dark overflow menu to match a dark window.
tabs.TabPagesOverFlowMenuBackColor = Color.FromArgb(37, 37, 38);
tabs.TabPagesOverFlowMenuForeColor = Color.Gainsboro;
tabs.TabPagesOverFlowMenuBorderColor = Color.FromArgb(63, 63, 70);
tabs.TabPagesOverFlowMenuHighlightColor = Color.FromArgb(62, 62, 64);
tabs.TabPagesOverFlowMenuShowImageMargin = false;

TabPagesOverFlowMenuBorderColor

public Color TabPagesOverFlowMenuBorderColor

Gets or sets the colour of the overflow menu's border and separators.

Value
The default is Color.Empty: the standard menu border.
Designer category
Appearance

TabPagesOverFlowMenuDropDownColor

public Color TabPagesOverFlowMenuDropDownColor

Gets or sets the colour of the overflow glyph – the bar and arrow the menu drops from – rather than of the menu itself.

Value
The default is SystemColors.WindowText; SystemColors.GrayText is used while the strip has no pages.
Remarks

The menu's own colours are TabPagesOverFlowMenuBackColor and the properties beside it.

TabPagesOverFlowMenuFont

public Font TabPagesOverFlowMenuFont

Gets or sets the font of the overflow menu.

Value
The default is null: the system menu font.
Designer category
Appearance

TabPagesOverFlowMenuForeColor

public Color TabPagesOverFlowMenuForeColor

Gets or sets the colour of the overflow menu's text.

Value
The default is Color.Empty: the standard menu text colour.
Designer category
Appearance

TabPagesOverFlowMenuGlyphActiveRectangleBorderColor

public Color TabPagesOverFlowMenuGlyphActiveRectangleBorderColor

Gets or sets the outline of the box drawn behind the overflow glyph while the pointer is over it.

Value
The default is SystemColors.Highlight.

TabPagesOverFlowMenuGlyphActiveRectangleFillColor

public Color TabPagesOverFlowMenuGlyphActiveRectangleFillColor

Gets or sets the fill of the box drawn behind the overflow glyph while the pointer is over it.

Value
The default is SystemColors.Highlight.
See also

TabPagesOverFlowMenuHighlightColor

public Color TabPagesOverFlowMenuHighlightColor

Gets or sets the colour drawn behind, and round, the item the pointer is over in the overflow menu.

Value
The default is Color.Empty: the standard highlight.
Designer category
Appearance

TabPagesOverFlowMenuHighlightTextColor

public Color TabPagesOverFlowMenuHighlightTextColor

Gets or sets a text colour for the overflow menu's highlighted item, which the menu does not use.

Value
The default is Color.Empty.
Designer category
Appearance
Remarks

The highlighted item's text is drawn in the same colour as the others (TabPagesOverFlowMenuForeColor); choose a TabPagesOverFlowMenuHighlightColor that it reads well against.

TabPagesOverFlowMenuShowImageMargin

public bool TabPagesOverFlowMenuShowImageMargin

Gets or sets whether the overflow menu keeps the strip down its left-hand side where item images go.

Value
The default is true, as in a standard Windows menu.
Default
true
Designer category
Appearance
Remarks

Turning it off gives a flatter, themed look; do so only if the pages carry no images (BinaryPowerTabPage.Image, BinaryPowerTabPage.OverflowMenuImage).

TabPagesOverflowCalculationStrategy

public TabPagesOverflowCalculationStrategy TabPagesOverflowCalculationStrategy

Gets or sets how many auto-sized tabs the strip assumes fit on a row when it fills rows by counting tabs rather than measuring them.

Value
The default is TabPagesOverflowCalculationStrategy.Pessimistic.
Remarks

Matters only while ShouldAutoSizeTabs is on and the rows are counted by tab width rather than measured – that is, with UseLegacyMultiLineRowPacking on. TabPagesOverflowCalculationStrategy.Pessimistic allows one tab fewer per row than would fit; TabPagesOverflowCalculationStrategy.Optimistic allows as many as fit. Setting it lays the strip out again.

TabPagesRenderingLocation

public TabPagesRenderingLocation TabPagesRenderingLocation

Gets or sets whether the tab headers run along the top or the bottom of the strip.

Value
The default is TabPagesRenderingLocation.Top.
Remarks

The page area moves to the other side of the headers. With the headers at the bottom, TabBottomOrientationCloseButtonPosition places the close buttons, and the side bar (TabPageHeaderShowsSideBar) is not drawn.

TabRenderingStyle

public RenderingStyle TabRenderingStyle

Gets or sets the shape and colouring of the tab headers.

Value
One of the RenderingStyle values. The default is RenderingStyle.VisualStudio2008.
Remarks

The Visual Studio and Windows XP styles have fixed colours. RenderingStyle.Custom and RenderingStyle.TrapeziumTop fill the headers from CustomStartColor to CustomEndColor (or a page's own BinaryPowerTabPage.CustomStartColor and BinaryPowerTabPage.CustomEndColor), and the selected header from the selection colours (UseTabCurrentSelectionIndicatorColor).

Choosing RenderingStyle.TrapeziumTop also turns on DrawTabPageOnTopOfEachOther, which stays on if another style is chosen later. Setting this property does not raise TabStyleRenderingStyleChanged.

Example
tabs.TabRenderingStyle = RenderingStyle.Custom;
tabs.CustomStartColor = Color.FromArgb(225, 236, 248);
tabs.CustomEndColor = Color.White;
tabs.TabPageCurrentSelectionIndicatorStartColor = Color.FromArgb(0, 120, 215);
tabs.TabPageCurrentSelectionIndicatorEndColor = Color.FromArgb(153, 201, 239);

TabsOverflowMode

public OverflowMode TabsOverflowMode

Gets or sets what the strip does when the headers are wider than it is: keep one row and list the tabs in a drop-down menu, or wrap them onto extra rows.

Value
The default is OverflowMode.Menu.
Remarks

In OverflowMode.Menu mode as many headers are shown as fit, always including the selected one, and a glyph at the right-hand end (ShowOverflowMenuGlyph) lists every visible tab whose header is enabled. In OverflowMode.MultiLine mode every header is shown, the page area shrinks by one TabPageHeaderHeight per extra row, and there is no glyph.

See also

ThemeBorderColorCanBeOverridden

public bool ThemeBorderColorCanBeOverridden

Gets or sets whether border colours you set are kept in the styles that otherwise set their own.

Value
The default is false.
Remarks

While this is off, the RenderingStyle.VisualStudio2008, RenderingStyle.WindowsXP and RenderingStyle.ExtendedWindowsXP styles set each page's BinaryExtendedPanel.BorderColor as they paint, and the Visual Studio 2008 style also sets TabPageBorderColor.

ToolTipConfiguration

public ToolTipConfiguration ToolTipConfiguration

Gets or sets how the tab headers' tooltips look and behave: their delays, colours, icon, title and style.

Value
The settings object. The default is a new one, with the defaults its properties list. Do not set null.
Remarks

The settings are applied each time a tooltip is shown, so changing a property of the current object takes effect at the next tooltip. The text of each tooltip is the page's BinaryPowerTabPage.ToolTipText.

Example
tabs.ToolTipConfiguration.IsBalloon = true;
tabs.ToolTipConfiguration.ToolTipIcon = ToolTipIcon.Info;
tabs.ToolTipConfiguration.ToolTipTitle = "Document";
tabs.ToolTipConfiguration.InitialDelay = 300;
See also

UseLegacyMultiLineRowPacking

public bool UseLegacyMultiLineRowPacking

Gets or sets whether the rows of headers in OverflowMode.MultiLine mode are filled by counting tabs rather than by measuring them.

Value
The default is false.
Remarks

With false, each row takes as many headers as genuinely fit, measured at the width each is painted at.

With true, every header is assumed to be TabPageHeaderWidth wide, so rows usually hold fewer tabs than would fit and wrap earlier. Use it only to keep a layout that depends on that rule.

UseTabCurrentSelectionIndicatorColor

public bool UseTabCurrentSelectionIndicatorColor

Gets or sets whether the selected header is filled with the selection colours in the RenderingStyle.Custom and RenderingStyle.TrapeziumTop styles.

Value
true (the default) to fill it from TabPageCurrentSelectionIndicatorStartColor to TabPageCurrentSelectionIndicatorEndColor; false to use the custom colours, as the other headers do.

Methods

AddTab

public void AddTab(BinaryPowerTabPage tabPage)

Adds a page as the last tab, without selecting it.

Parameters
tabPage
The page to add. A page already in the strip is not added twice; null is ignored.
Remarks

The page is docked to fill the page area and TabPageSelectionChanged is raised with TabPageChangeTriggerSource.Added. The first page added to an empty strip is selected when the strip next paints.

See also

AddTab

public void AddTab(BinaryPowerTabPage tabPage, bool selectThisTabPageafterAdd)

Adds a page as the last tab, and selects it if asked to.

Parameters
tabPage
The page to add. null is ignored.
selectThisTabPageafterAdd
true to make the new page the SelectedTabPage.
Remarks

AddTab

public void AddTab(BinaryPowerTabPage tabPage, bool selectThisTabPageafterAdd, bool positionThisNewPageInTheLeftHandCorner)

Adds a page as the first or the last tab, and selects it if asked to.

Parameters
tabPage
The page to add. null is ignored.
selectThisTabPageafterAdd
true to make the new page the SelectedTabPage.
positionThisNewPageInTheLeftHandCorner
true to put the page first in TabPages, at the left-hand end of the headers; false to put it last.
Example
// A new search result opens as the first tab, and is shown straight away.
var results = new BinaryPowerTabPage { Text = "Results: \"overdue invoices\"" };
results.Controls.Add(resultsGrid);
tabs.AddTab(results, true, true);

Dispose

protected override void Dispose(bool disposing)

Releases the strip's resources, disposing every page it holds, the overflow menu and the tooltip.

Parameters
disposing
true when called from Dispose; false from the finalizer.

GetDisabledImageFromNormal static

public static Bitmap GetDisabledImageFromNormal(Bitmap normalImage)

Makes a grey copy of an image, as a disabled header draws its page's image when it has no BinaryPowerTabPage.DisabledImage.

Parameters
normalImage
The image to copy; it is not changed. Must not be null.
Returns

A new bitmap, in shades of grey, with the colour of its top-left pixel made transparent. The caller disposes it.

GetTabPageByPoint

public BinaryPowerTabPage GetTabPageByPoint(Point pt)

Gets the tab whose header is at a point.

Parameters
pt
The point, in the strip's client coordinates.
Returns

The page whose header contains the point, or null if there is none. Only headers on show count.

See also

HitTest

public HitTestArea HitTest(Point pt)

Tells which part of the strip is at a point: a header, a header's close button, the overflow glyph, the strip-level close button, or none of them.

Parameters
pt
The point, in the strip's client coordinates (as in MouseEventArgs.Location).
Returns

The part at the point. A point on a header whose page has BinaryPowerTabPage.IsHeaderEnabled off, or on a button that is switched off, gives HitTestArea.None. Never throws.

Remarks

Headers are tested where they were last painted, so a header that is not on show is never hit.

Example
tabs.MouseUp += (sender, e) =>
{
    // A right-click on a header offers that tab's own menu.
    if (e.Button == MouseButtons.Right && tabs.HitTest(e.Location) == HitTestArea.TabPage)
    {
        tabContextMenu.Tag = tabs.GetTabPageByPoint(e.Location);
        tabContextMenu.Show(tabs, e.Location);
    }
};
See also

OnCreateControl

protected override void OnCreateControl()

Starts watching the form and containers around the strip, for a strip added to a form that already exists, then carries on as the base class does.

OnDoubleClick

protected override void OnDoubleClick(EventArgs e)

Raises TabPageDoubleClicked for a double-click on a header, and the Control.DoubleClick event for a double-click anywhere else.

Parameters
e
The event data.
Remarks

A double-click on a header, a close button or the overflow glyph does not raise Control.DoubleClick.

OnFontChanged

protected override void OnFontChanged(EventArgs e)

Raises the Control.FontChanged event, and recalculates the header height when EnableAutomaticUpdateOfTabPagesHeaderSize is on.

Parameters
e
The event data.

OnHandleCreated

protected override void OnHandleCreated(EventArgs e)

Raises the Control.HandleCreated event, and starts watching the form and containers around the strip so the headers are laid out again when they resize.

Parameters
e
The event data.

OnHandleDestroyed

protected override void OnHandleDestroyed(EventArgs e)

Stops watching the form and containers around the strip, then raises the Control.HandleDestroyed event.

Parameters
e
The event data.

OnKeyDown

protected override void OnKeyDown(KeyEventArgs e)

Selects the next tab when Ctrl+Tab reaches the strip, then raises the Control.KeyDown event.

Parameters
e
The event data.
Remarks

The next tab is the next page in TabPages; on the last page, Ctrl+Tab does nothing.

OnLayout

protected override void OnLayout(LayoutEventArgs e)

Raises the Control.Layout event, and at run time works out again how many headers fit.

Parameters
e
The event data.

OnMouseCaptureChanged

protected override void OnMouseCaptureChanged(EventArgs e)

Raises the Control.MouseCaptureChanged event, and abandons a header drag whose capture was taken away while the button is still down – by a window activated from the keyboard, or a dialog - so nothing is dropped later and no bar is left behind.

Parameters
e
The event data.

OnMouseDown

protected override void OnMouseDown(MouseEventArgs e)

Raises the Control.MouseDown event, then acts on a left-button press: selects the tab under the pointer, opens the overflow menu, or closes a tab whose close button was pressed.

Parameters
e
The event data.

OnMouseEnter

protected override void OnMouseEnter(EventArgs e)

Raises the Control.MouseEnter event, and notes the header the pointer entered over, for its tooltip.

Parameters
e
The event data.

OnMouseHover

protected override void OnMouseHover(EventArgs e)

Raises the Control.MouseHover event, and shows the tooltip of the header under the pointer.

Parameters
e
The event data.

OnMouseLeave

protected override void OnMouseLeave(EventArgs e)

Raises the Control.MouseLeave event, hides any tooltip and clears the highlights on the buttons.

Parameters
e
The event data.

OnMouseMove

protected override void OnMouseMove(MouseEventArgs e)

Raises the Control.MouseMove event, then carries a header drag along, or updates the tooltips and the highlights on the close buttons and the overflow glyph.

Parameters
e
The event data.

OnMouseUp

protected override void OnMouseUp(MouseEventArgs e)

Raises the Control.MouseUp event, and drops a header being dragged at the place the drop bar shows.

Parameters
e
The event data.

OnPaint

protected override void OnPaint(PaintEventArgs e)

Paints the headers, the overflow glyph and any drop bar; the Control.Paint event is not raised.

Parameters
e
The event data.

OnParentBackColorChanged

protected override void OnParentBackColorChanged(EventArgs e)

Raises the Control.ParentBackColorChanged event, and repaints the drop-shadow band, which shows the colour behind the strip.

Parameters
e
The event data.

OnParentChanged

protected override void OnParentChanged(EventArgs e)

Raises the Control.ParentChanged event, and starts watching the strip's new form and containers when it is moved to another parent at run time.

Parameters
e
The event data.

OnResize

protected override void OnResize(EventArgs e)

Raises the Control.Resize event, and resizes the page area to the room the headers leave.

Parameters
e
The event data.

OnSizeChanged

protected override void OnSizeChanged(EventArgs e)

Raises the Control.SizeChanged event, then works out again how many headers fit and lays them out for the new size.

Parameters
e
The event data.

OnSystemColorsChanged

protected override void OnSystemColorsChanged(EventArgs e)

Raises the Control.SystemColorsChanged event and repaints the strip, whose default colours come from the system palette.

Parameters
e
The event data.

OnTabStyleRenderingStyleChanged

protected virtual void OnTabStyleRenderingStyleChanged(EventArgs e)
Parameters
e
The event data.

RearrangeTabPageLocation

public void RearrangeTabPageLocation(BinaryPowerTabPage pageToMove, int destinationIndexToMoveTheDesiredTabPageTo)

Moves a page to a new position among the tabs.

Parameters
pageToMove
The page to move. A page that is not one of this strip's is ignored.
destinationIndexToMoveTheDesiredTabPageTo
The zero-based position the page is to take in TabPages.
Exceptions
System.ArgumentOutOfRangeException
The position is negative or past the last page.
Remarks

Does nothing on a strip with no pages. The page is taken out and put back, so TabPageSelectionChanged is raised twice: TabPageChangeTriggerSource.Removed, then TabPageChangeTriggerSource.Added.

RefreshLayout

public void RefreshLayout()

Lays the headers and the page area out again from scratch.

Remarks

Call it after a change the strip does not watch – for example a page's BinaryPowerTabPage.HeaderTextFont, which does not lay the headers out again by itself.

See also

RemoveTab

public void RemoveTab(BinaryPowerTabPage tabPage)

Removes a page from the strip and selects a neighbouring tab.

Parameters
tabPage
The page to remove.
Remarks

The page is removed from TabPages (raising TabPageSelectionChanged with TabPageChangeTriggerSource.Removed) but is not disposed. Then, while pages remain, the page that was just before it is selected – the first visible page if it was the first – whether or not the removed page was the selected one. With Control.RightToLeft on, the page after it is selected instead.

Neither TabPageClosing nor TabPageClosed is raised.

ResetExternal

public void ResetExternal()

Does nothing. Calling it has no effect on the strip.

See also

ResetInvalidate

public void ResetInvalidate()

Works out again how many headers fit, lays the strip out and repaints it.

Remarks

Use it after a change that affects how many headers fit in OverflowMode.Menu mode, such as new captions on several pages.

See also

SetBoundsCore

protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)

Sets the strip's bounds with layout suspended on the strip and every control inside it, so the pages are laid out once for the new size.

Parameters
x
The new left edge, in pixels.
y
The new top edge, in pixels.
width
The new width, in pixels.
height
The new height, in pixels.
specified
Which of the bounds are being set.

ShouldSerializeFont

public bool ShouldSerializeFont()

Tells the designer whether to write Control.Font into the designer file: only when it differs from the system's default font.

ShouldSerializeItems

public bool ShouldSerializeItems()

Part of the designer's serialisation support; not for use from application code. Returns true when the strip has pages.

ShouldSerializeSelectedItem

public bool ShouldSerializeSelectedItem()

Part of the designer's serialisation support; not for use from application code. Always returns true.

WndProc

protected override void WndProc(ref Message m)

Processes the strip's window messages, reserving and painting the drop-shadow band when ShouldDrawDropShadow is on.

Parameters
m
The message.
Remarks

The band is part of the window's non-client area, along the right and bottom edges, so the headers, the border and the pages all cast the shadow.

Events

TabElementsLayoutChanging

public event EventHandler<string> TabElementsLayoutChanging

Occurs just before the strip lays its headers out again.

Remarks

The event data is the name of the member whose change set off the layout – for example "TabPageHeaderHeight", "Size" or "OnSizeChanged" – so a handler can react to some causes and not others.

Do not set the member named in the event data from the handler: that starts another layout, and raises the event again.

Example
tabs.TabElementsLayoutChanging += (sender, changedMember) =>
{
    if (changedMember == nameof(BinaryPowerTabStrip.TabPageHeaderHeight))
    {
        statusLabel.Text = "Header height changed";
    }
};

TabPageClosed

public event EventHandler TabPageClosed

Occurs after the user has closed a tab with a close button and its page has been removed.

Remarks

The event data does not say which page; note it in TabPageClosing if needed.

TabPageClosing

public event TabPageClosingHandler TabPageClosing

Occurs when the user clicks a close button, before the page is removed; a handler can cancel.

Remarks

TabPageClosingEventArgs.TabPage is the page about to close. Set Cancel to keep it; otherwise it is removed with RemoveTab and TabPageClosed follows. Removing a page from code does not raise this event.

TabPageDoubleClicked

public event EventHandler<TabPageDoubleClickedEventArgs> TabPageDoubleClicked

Occurs when the user double-clicks a tab header.

Remarks

Not raised for a header whose page has BinaryPowerTabPage.IsHeaderEnabled off, nor for the close buttons or the overflow glyph.

Example
// Double-clicking a tab opens its document in a window of its own.
tabs.TabPageDoubleClicked += (sender, e) => OpenInNewWindow(e.TabPage);

TabPageSelectionChanged

public event TabPageChangedHandler TabPageSelectionChanged

Occurs when the selected tab changes, and also when a page is added, removed or changed.

Remarks

TabPageChangedEventArgs.TabPageChangeType tells the cases apart:

TabStyleRenderingStyleChanged

public event EventHandler TabStyleRenderingStyleChanged

Occurs when OnTabStyleRenderingStyleChanged is called.

Remarks

The strip does not call it itself – setting TabRenderingStyle does not raise this event - so it is raised only by a derived class.