HypernovaDesktop Components · docs
Binarymission
WinFormsSpinner › BinaryDomainUpDown

BinaryDomainUpDown

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

BinaryDomainUpDown is an Extended, feature-rich and "flat" styled DomainUpDown navigation control for the Winforms .NET platform.

public class BinaryDomainUpDown : DomainUpDown

Inherits from / implements: DomainUpDown

Remarks

BinaryDomainUpDown is a feature-rich control to conveniently replace the standard .NET framework DomainUpDown control.
The control derives from the standard .NET framework DomainUpDown control and introduces new properties to provide a "flat" look-and-feel and some additional GUI features like supporting custom colors for drawing the control's borders, inner button controls, the up and down arrow marks and also providing the ever popular VS.NET/XP fame mouse hovering effects.

Members at a glance

BinaryDomainUpDownInitializes a new instance of BinaryDomainUpDown class.
BorderColorGets or sets the color of the control's border, when the mouse is over it or it has the focus.
BorderStyleThe BinaryDomainUpDown control only supports a fixed 3D border style.
DrawStyleIsFlatGets or sets whether the control is to be drawn with a "flat" look or with a 3D look.
ShowBorderAlwaysGets or sets whether the control will always have its border displayed, even when the control is not currently in focus.
UpDownArrowPressedBackColorGets or sets the color of the internal buttons (where the Up and Down arrows are painted), when they are in pressed state.
UpDownArrowsColorGets or sets the color of the Up and down arrow marks.
UpDownButtonNormalBackColorGets or sets the color of the internal buttons (where the Up and Down arrows are painted), when they are not in focussed state (when the input focus is not on them).
UpDownButtonOnFocusBackColorGets or sets the color of the internal buttons (where the Up and Down arrows are painted), when they are in focussed state (when the input focus is on them).
CreateHandleCreates the window handle for this control.
OnFontChangedRaises the FontChanged event, re-fitting the spin button to the new font.
OnGotFocusRaises the GotFocus event. BinaryDomainUpDown overrides it so the control's own handling runs alongside the base behavior.
OnLayoutRaises the Layout event. BinaryDomainUpDown overrides it so the spin button is sized from the control's own height and font rather than from a fixed constant.
OnLostFocusRaises the LostFocus event. BinaryDomainUpDown overrides it so the control's own handling runs alongside the base behavior.
OnSystemColorsChangedRaises the SystemColorsChanged event. BinaryDomainUpDown overrides it so the control's own handling runs alongside the base behavior.
WndProcProcesses the Windows messages sent to this control's window.

Constructors

BinaryDomainUpDown

public BinaryDomainUpDown()

Initializes a new instance of BinaryDomainUpDown class.

Properties

BorderColor

public Color BorderColor

Gets or sets the color of the control's border, when the mouse is over it or it has the focus.

BorderStyle

public new BorderStyle BorderStyle

The BinaryDomainUpDown control only supports a fixed 3D border style.

DrawStyleIsFlat

public bool DrawStyleIsFlat

Gets or sets whether the control is to be drawn with a "flat" look or with a 3D look.

The default style is the "flat" look and hence the default value is true.
If you need to paint the control emulating the standard .NET framework DomainUpDown 3D style, set this property to false.

ShowBorderAlways

public bool ShowBorderAlways

Gets or sets whether the control will always have its border displayed, even when the control is not currently in focus.

If set to true, the control will always display its border even when the input focus is not on the control.
By default, this property is set to true.

UpDownArrowPressedBackColor

public Color UpDownArrowPressedBackColor

Gets or sets the color of the internal buttons (where the Up and Down arrows are painted), when they are in pressed state.

UpDownArrowsColor

public Color UpDownArrowsColor

Gets or sets the color of the Up and down arrow marks.

UpDownButtonNormalBackColor

public Color UpDownButtonNormalBackColor

Gets or sets the color of the internal buttons (where the Up and Down arrows are painted), when they are not in focussed state (when the input focus is not on them).

UpDownButtonOnFocusBackColor

public Color UpDownButtonOnFocusBackColor

Gets or sets the color of the internal buttons (where the Up and Down arrows are painted), when they are in focussed state (when the input focus is on them).

Methods

CreateHandle

protected override void CreateHandle()

Creates the window handle for this control.

OnFontChanged

protected override void OnFontChanged(EventArgs e)

Raises the FontChanged event, re-fitting the spin button to the new font.

e
The data for the event.
The button width is derived from the font, and UpDownBase repositions its own children here directly rather than by asking for a layout, so without this the button would keep the width it had until something else resized the control.

OnGotFocus

protected override void OnGotFocus(EventArgs e)

Raises the GotFocus event. BinaryDomainUpDown overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnLayout

protected override void OnLayout(LayoutEventArgs e)

Raises the Layout event. BinaryDomainUpDown overrides it so the spin button is sized from the control's own height and font rather than from a fixed constant.

e
The data for the event.
UpDownBase gives the spin button a fixed 16 unit width. On a 250% display carrying a large font that leaves a postage stamp of a button glued to the side of a control several times its height, with the text area sized from whatever is left over.

Windows sizes its own spin buttons from SM_CXVSCROLL , which is DPI aware but takes no account of the font, so the width used here is the larger of that metric and a fraction of the font height - capped so the button can never take more than a third of a narrow control.

The arrows need no separate arithmetic: PaintTarget already sizes them from the button rectangle, so a wider button draws larger glyphs by itself.

OnLostFocus

protected override void OnLostFocus(EventArgs e)

Raises the LostFocus event. BinaryDomainUpDown overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnSystemColorsChanged

protected override void OnSystemColorsChanged(EventArgs e)

Raises the SystemColorsChanged event. BinaryDomainUpDown overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

WndProc

protected override void WndProc(ref Message m)

Processes the Windows messages sent to this control's window.