Combo Box
The shared base of BinaryTextComboBox and BinaryImageComboBox: a Windows Forms
combo box that draws its own flat border, drop-down button and items, in colours you choose.
Assembly
| Assembly | Binarymission.WinForms.Controls.BinaryComboBox.dll |
| Root namespace | Binarymission.WinForms.Controls.ListControls |
| Target frameworks | .NET Framework 4.8, .NET 6 / 8 / 10 |
Overview
What it is for
Everything the two Hypernova combo boxes have in common lives here: the colours of the border, the
drop-down button and the highlighted item, how the border behaves when the pointer and the focus come and go,
the optional push-button style drop-down button, the look of the single-column drop-down list, and the
extended read-only mode. The class is abstract and is not in the Toolbox; place a
BinaryTextComboBox (text, data binding, auto-completion, a multi-column drop-down) or a
BinaryImageComboBox (an image beside each item, drive and font lists) on the form instead.
Colours
Two colours drive the whole look. CustomControlBorderColor is the border and the outline
round the drop-down button. CustomPaintingColor is blended with the window colour to give the
drop-down button face and the highlighted item, and blended again for the button while the list is open. The
three alpha-blending factors (0 to 255) say how much of it goes into each blend:
AlphaBlendFactorForItemSelectionColor, AlphaBlendFactorForDropDownPressedColor
and AlphaBlendFactorForControlPainting. EmulateThisXPTheme sets all five at once
to one of the Windows XP colour schemes.
The border
With ShowBorderAlways on (the default) the border is always drawn;
CustomControlBorderColorWhenNotInFocus gives it a quieter colour while the control does not have
the focus. With it off, the border appears only while the pointer is over the control or it has the focus.
Things to know
Simpleis not supported:DropDownStyleignores it.- Right-to-left layout is not supported:
RightToLeftstaysNo. - The flat drawing is used by
BinaryImageComboBoxalways, and byBinaryTextComboBoxwhile itsBinaryTextComboBox.DisplayStyleIsFlatistrue; otherwise the text combo box looks like a standard Windows combo box and the colours here are not used. - Metrics are logical pixels (1/96 inch), scaled to the display the control is on.
Getting started
A text combo box in the application's accent colour, with a quiet grey border while it does not have the focus.
var statusPicker = new BinaryTextComboBox
{
Location = new Point(12, 12),
Width = 220,
DropDownStyle = ComboBoxStyle.DropDownList,
};
statusPicker.Items.AddRange(new object[] { "Open", "In progress", "On hold", "Closed" });
statusPicker.SelectedIndex = 0;
statusPicker.CustomPaintingColor = Color.FromArgb(0, 120, 215);
statusPicker.CustomControlBorderColor = Color.FromArgb(0, 90, 158);
statusPicker.CustomControlBorderColorWhenNotInFocus = Color.Silver;
statusPicker.AlphaBlendFactorForItemSelectionColor = 90; // a light tint for the highlighted item
statusPicker.ControlArrowColor = Color.FromArgb(0, 90, 158);
statusPicker.SelectedIndexChanged += (sender, e) => Text = "Status: " + statusPicker.SelectedItem;
Controls.Add(statusPicker);API reference
Binarymission.WinForms.Controls.ListControls
class BinaryComboBox | The shared base of BinaryTextComboBox and BinaryImageComboBox: a Windows Forms combo box that draws its own flat border, drop-down button and items, in colours you choose. |
class BinaryComboBoxColumn | A DataGridView column whose cells are edited with a BinaryTextComboBox - so a grid cell can offer the multi-column drop-down, its sorting, grouping and filtering, and the Hypernova look. |
class BinaryImageComboBox | A pick-list combo box that shows an image beside each item - and can turn itself into a ready-made drive list or font list. |
class DriveInformation | Details of one entry of a BinaryImageComboBox drive list: its path, volume label, display name and type, and the file-system limits Windows reports for it. |
delegate DriveSelectionChangeHandler | Represents the method that handles DriveSelectionChanged. |
delegate DropDownProcessHandler | Represents the method that handles DropDownAboutToBeShown, and can stop the list opening. |
class BinaryTextComboBox | A text combo box that adds auto-completion, a read-only mode, and a multi-column drop-down that can sort, filter, group and export the rows of a data source - the Hypernova combo box for picking a record by its name. |
delegate AutoCompletingHandler | Represents the method that handles AutoCompleting. |
delegate CustomSortingHandler | Represents the method that handles CustomSorting. |
delegate DropDownProcessHandler | Represents the method that handles DropDownAboutToBeShown, and can stop the drop-down opening. |
class MultiColumnDropDownWindowConfiguration | The appearance of the multi-column drop-down of a BinaryTextComboBox: its header and footer bands, its column headings and the message it shows when there are no rows. |
delegate NotInListHandler | Represents the method that handles NotInList. |
class BinaryTreeListViewComboBoxCell | The cell of a BinaryComboBoxColumn: a combo box cell whose editor is a BinaryTextComboBox. |
enum BuiltinFilterOnNonStringTypeColumnFilterResultsMode | How the built-in filter of the BinaryTextComboBox multi-column drop-down matches a column that holds numbers, dates or other values that are not text. |
enum ColumnDataTypeFormat | The kind of value a column of the BinaryTextComboBox multi-column drop-down holds, which decides how its values are formatted for display. |
class ColumnDataTypeFormatInfoContainer | How one column of the BinaryTextComboBox multi-column drop-down formats its values: the kind of value it holds and the format string to apply. |
enum DropDownWindowDisplayOrientation | Which way the multi-column drop-down of a BinaryTextComboBox extends from the control. |
enum FontNameDisplayStyle | How a BinaryImageComboBox font list draws the font names. |
enum HeaderImageStyle | Which picture, if any, the header band of a multi-column drop-down shows. |
enum ItemSelectionClick | Whether the user picks a row of the BinaryTextComboBox multi-column drop-down with one click or two. |
enum ListStyle | What a BinaryImageComboBox lists: your own images and text, the computer's drives, or the installed fonts. |
class MultiColumnDropDownWindowConfiguration | The appearance of the multi-column drop-down opened by the cells of a BinaryComboBoxColumn: its header and footer bands, its column heading font and its no-data message. |
class MultiColumnDropDownWindowConfigurationTypeConverter | Lets the Properties window show a MultiColumnDropDownWindowConfiguration as an expandable set of its own properties, rather than as a single value. |
enum MultiColumnDroplistWindowAnimationStyle | How the multi-column drop-down of a BinaryTextComboBox animates as it closes after the user picks a row. |
class MultiColumnViewUIElementsTextProvider | The captions, menu commands and messages of the BinaryTextComboBox multi-column drop-down, gathered in one place so they can be translated or reworded. |
enum XPTheme | The Windows XP colour schemes a Hypernova combo box can take its colours from. |