HypernovaDesktop Components · docs
Binarymission
WinForms › Panel Bar › BinaryPanelBarButton

BinaryPanelBarButton

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

One section of a BinaryPanelBar: a large button with an image and a title which, when clicked, shows its page of controls – its ContainedPanel – in the bar.

public class BinaryPanelBarButton : UserControl

Inherits from / implements: UserControl

Remarks

Give the button a ButtonText, a 24-pixel ButtonImage, a 16-pixel ButtonSmallImage for the icon strip, and a ContainedPanel, then add it with BinaryPanelBar.AddBinaryPanelBarButton. The bar decides whether it shows as a large button or as an icon, and draws it in the bar's theme.

Construct it with BinaryPanelBarButton(), or set ParentControl, so that it draws correctly when the bar collapses to its rail.

Examples

var contactsPage = new BinaryPanelBarContainedPanel();
contactsPage.Controls.Add(new ListView { Dock = DockStyle.Fill, View = View.List });

var contacts = new BinaryPanelBarButton(navigation)
{
    ButtonText = "Contacts",
    ButtonImage = new Bitmap("Images\\contacts-24.png"),
    ButtonSmallImage = new Bitmap("Images\\contacts-16.png"),
    ContainedPanel = contactsPage,
};
contacts.Click += (s, e) => LoadContacts();
navigation.AddBinaryPanelBarButton(contacts);

See also

Members at a glance

Constructors
BinaryPanelBarButtonInitialises a new button for a given bar.
BinaryPanelBarButtonInitialises a new button with no text, image or page. Prefer BinaryPanelBarButton() when the bar is known.
Properties
ButtonBorderStyleGets or sets the border drawn round the button, in the theme's line colour.
ButtonImageGets or sets the picture drawn at the left of the button, before its text.
ButtonSmallImageGets or sets the picture shown in the bar's icon strip while the button is not in the stack.
ButtonTextGets or sets the section's title, drawn on the button and shown in the bar's header while the button is selected.
ContainedPanelGets or sets the page of controls the bar shows, filling the space above the buttons, while this button is selected.
EndColorGets or sets the colour at the other end of the button's normal gradient, used while the bar's theme is XPTheme.None.
HoverEndColorGets or sets the colour at the bottom of the gradient while the pointer is over the button.
HoverSelectedEndColorGets or sets the other end of the gradient while this is the selected button and the pointer is over it.
HoverSelectedStartColorGets or sets one end of the gradient while this is the selected button and the pointer is over it.
HoverStartColorGets or sets the colour at the top of the gradient while the pointer is over the button.
ItemColorRenderingStyleGets or sets how the button is filled: a plain gradient, an Office-style two-tone finish, or the system's colours.
NotAvailableForUseGets or sets whether the section is withdrawn from the bar, hidden from both the stack and the icon strip.
ParentControlGets or sets the bar this button belongs to.
SelectedEndColorGets or sets the colour at the bottom of the gradient while this is the selected button.
SelectedStartColorGets or sets the colour at the top of the gradient while this is the selected button.
StartColorGets or sets the colour at one end of the button's normal gradient, used while the bar's theme is XPTheme.None.
WirePanelBarButtonClickEventToBaseBarButtonGets or sets whether clicking the button's small icon in the bar's strip also raises this button's Control.Click event.
Methods
DisposeReleases the resources the button uses.
ToStringReturns the button's ButtonText.

Constructors

BinaryPanelBarButton

public BinaryPanelBarButton(BinaryPanelBar parentHost) : this()

Initialises a new button for a given bar.

Parameters
parentHost
The bar the button will be added to; stored in ParentControl. This does not add the button to the bar.

BinaryPanelBarButton

public BinaryPanelBarButton()

Initialises a new button with no text, image or page. Prefer BinaryPanelBarButton() when the bar is known.

Properties

ButtonBorderStyle

public PanelBarBorderStyle ButtonBorderStyle

Gets or sets the border drawn round the button, in the theme's line colour.

Value
The default is PanelBarBorderStyle.Thin.
Remarks

The bar's BinaryPanelBar.ButtonBorderStyle and BinaryPanelBar.ControlBorderStyle set this on all its buttons.

ButtonImage

public Bitmap ButtonImage

Gets or sets the picture drawn at the left of the button, before its text.

Value
The default is null: no picture, and the text starts at the left.
Remarks

The picture is drawn 24 logical pixels square. On the collapsed rail it is centred and the text is left out.

ButtonSmallImage

public Bitmap ButtonSmallImage

Gets or sets the picture shown in the bar's icon strip while the button is not in the stack.

Value
The default is null, which shows ButtonImage there instead.
Remarks

A 16-pixel picture suits the strip.

ButtonText

public string ButtonText

Gets or sets the section's title, drawn on the button and shown in the bar's header while the button is selected.

Value
The default is empty.
Remarks

The text is drawn on one line after the image, in the button's Control.Font and Control.ForeColor, trimmed with an ellipsis; an ampersand underlines the next letter. It is also the tooltip of the button's small icon and its entry in the chevron menu.

ContainedPanel

public BinaryPanelBarContainedPanel ContainedPanel

Gets or sets the page of controls the bar shows, filling the space above the buttons, while this button is selected.

Value
The default is null: an empty page.
Remarks

Set it before adding the button to the bar. Setting it marks the button as selected and, on a button already on the bar, shows the page and raises BinaryPanelBar.BinaryPanelBarButtonContainedPanelAppliedOrChanged.

EndColor

public Color EndColor

Gets or sets the colour at the other end of the button's normal gradient, used while the bar's theme is XPTheme.None.

Value
The default is Color.White; the bar sets its own BinaryPanelBar.EndColor on its buttons.

HoverEndColor

public Color HoverEndColor

Gets or sets the colour at the bottom of the gradient while the pointer is over the button.

Value
The default is RGB(255, 195, 90).

HoverSelectedEndColor

public Color HoverSelectedEndColor

Gets or sets the other end of the gradient while this is the selected button and the pointer is over it.

Value
The default is RGB(255, 223, 132).

HoverSelectedStartColor

public Color HoverSelectedStartColor

Gets or sets one end of the gradient while this is the selected button and the pointer is over it.

Value
The default is RGB(239, 130, 8).

HoverStartColor

public Color HoverStartColor

Gets or sets the colour at the top of the gradient while the pointer is over the button.

Value
The default is RGB(255, 255, 231); the bar's BinaryPanelBar.ButtonHoverStartColor sets it on all buttons.

ItemColorRenderingStyle

public PanelBarItemColorRenderingStyle ItemColorRenderingStyle

Gets or sets how the button is filled: a plain gradient, an Office-style two-tone finish, or the system's colours.

Value
The default is PanelBarItemColorRenderingStyle.OfficeStyleRenderer. A button added with BinaryPanelBar.AddBinaryPanelBarButton takes the bar's BinaryPanelBar.ItemColorRenderingStyle.

NotAvailableForUse

public bool NotAvailableForUse

Gets or sets whether the section is withdrawn from the bar, hidden from both the stack and the icon strip.

Value
true to withdraw the button. The default is false.
Remarks

The bar's BinaryPanelBar.BinaryPanelBarButtonNotAvailableForUseChanging can refuse the change, and BinaryPanelBar.BinaryPanelBarButtonNotAvailableForUseChanged follows it. The user changes it from the chevron menu's "Add or Remove Buttons".

ParentControl

public BinaryPanelBar ParentControl

Gets or sets the bar this button belongs to.

Value
The default is null, or the bar given to BinaryPanelBarButton().
Remarks

The bar does not set this when the button is added. Without it the button does not know when the bar is collapsed, and draws its text across the narrow rail instead of centring its image.

SelectedEndColor

public Color SelectedEndColor

Gets or sets the colour at the bottom of the gradient while this is the selected button.

Value
The default is RGB(247, 154, 25).
Remarks

Used by the plain and Office-style renderers; in the Office style the selected button is drawn in a fixed orange instead.

SelectedStartColor

public Color SelectedStartColor

Gets or sets the colour at the top of the gradient while this is the selected button.

Value
The default is RGB(255, 235, 156).
Remarks

Used by the plain and Office-style renderers; in the Office style the selected button is drawn in a fixed orange instead.

StartColor

public Color StartColor

Gets or sets the colour at one end of the button's normal gradient, used while the bar's theme is XPTheme.None.

Value
The default is Color.IndianRed; the bar sets its own BinaryPanelBar.StartColor on its buttons.
See also

WirePanelBarButtonClickEventToBaseBarButton

public bool WirePanelBarButtonClickEventToBaseBarButton

Gets or sets whether clicking the button's small icon in the bar's strip also raises this button's Control.Click event.

Value
The default is true.
Remarks

The bar's BinaryPanelBar.WirePanelBarButtonClickEventToBaseBarButton sets this on all its buttons.

Methods

Dispose

protected override void Dispose(bool disposing)

Releases the resources the button uses.

Parameters
disposing
true to release managed resources as well as unmanaged ones.

ToString

public override string ToString()

Returns the button's ButtonText.

Returns

The button's text, so a list of buttons reads as their titles.