BinaryPanelBarButton
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 | |
|---|---|
BinaryPanelBarButton | Initialises a new button for a given bar. |
BinaryPanelBarButton | Initialises a new button with no text, image or page. Prefer BinaryPanelBarButton()
when the bar is known. |
| Properties | |
ButtonBorderStyle | Gets or sets the border drawn round the button, in the theme's line colour. |
ButtonImage | Gets or sets the picture drawn at the left of the button, before its text. |
ButtonSmallImage | Gets or sets the picture shown in the bar's icon strip while the button is not in the stack. |
ButtonText | Gets or sets the section's title, drawn on the button and shown in the bar's header while the button is selected. |
ContainedPanel | Gets or sets the page of controls the bar shows, filling the space above the buttons, while this button is selected. |
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. |
HoverEndColor | Gets or sets the colour at the bottom of the gradient while the pointer is over the button. |
HoverSelectedEndColor | Gets or sets the other end of the gradient while this is the selected button and the pointer is over it. |
HoverSelectedStartColor | Gets or sets one end of the gradient while this is the selected button and the pointer is over it. |
HoverStartColor | Gets or sets the colour at the top of the gradient while the pointer is over the button. |
ItemColorRenderingStyle | Gets or sets how the button is filled: a plain gradient, an Office-style two-tone finish, or the system's colours. |
NotAvailableForUse | Gets or sets whether the section is withdrawn from the bar, hidden from both the stack and the icon strip. |
ParentControl | Gets or sets the bar this button belongs to. |
SelectedEndColor | Gets or sets the colour at the bottom of the gradient while this is the selected button. |
SelectedStartColor | Gets or sets the colour at the top of the gradient while this is the selected button. |
StartColor | Gets or sets the colour at one end of the button's normal gradient, used while the bar's theme is
XPTheme.None. |
WirePanelBarButtonClickEventToBaseBarButton | Gets or sets whether clicking the button's small icon in the bar's strip also raises this button's
Control.Click event. |
| Methods | |
Dispose | Releases the resources the button uses. |
ToString | Returns the button's ButtonText. |
Constructors
BinaryPanelBarButton
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
Initialises a new button with no text, image or page. Prefer BinaryPanelBarButton()
when the bar is known.
Properties
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
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
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 showsButtonImagethere instead.
Remarks
A 16-pixel picture suits the strip.
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
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
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 ownBinaryPanelBar.EndColoron its buttons.
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
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
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
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'sBinaryPanelBar.ButtonHoverStartColorsets it on all buttons.
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 withBinaryPanelBar.AddBinaryPanelBarButtontakes the bar'sBinaryPanelBar.ItemColorRenderingStyle.
NotAvailableForUse
Gets or sets whether the section is withdrawn from the bar, hidden from both the stack and the icon strip.
- Value
trueto withdraw the button. The default isfalse.
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
Gets or sets the bar this button belongs to.
- Value
- The default is
null, or the bar given toBinaryPanelBarButton().
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
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
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
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 ownBinaryPanelBar.StartColoron its buttons.
See also
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
Releases the resources the button uses.
Parameters
disposingtrueto release managed resources as well as unmanaged ones.
ToString
Returns the button's ButtonText.
Returns
The button's text, so a list of buttons reads as their titles.