Skip to content

NumberBox Class

InputBox control that allows text input.

C#
[DataContract]
public class NumberBox : TextBox

Inheritance objectControlBaseTextBox

Creates a new instance of the input box.

C#
public NumberBox(int width)

width int
The width of the input box.

Indicates that the input box (when numeric) will accept decimal points.

C#
[DataMember(Name = "AllowDecimalPoint")]
protected bool _allowDecimalPoint

Gets or sets whether or not this input box should restrict numeric input should allow a decimal point.

C#
public bool AllowDecimal { get; set; }

The maximum number that can be set for this text box.

C#
[DataMember]
public long NumberMaximum { get; set; }

Set both NumberMaximum and NumberMinimum to 0 to disable number bounds checking.

The minimum number that can be set for this text box.

C#
[DataMember]
public long NumberMinimum { get; set; }

Set both NumberMaximum and NumberMinimum to 0 to disable number bounds checking.

The default value to use when the current value is invalid and AllowDecimal is false.

C#
[DataMember]
public long DefaultValue { get; set; }

The default value to use when the current value is invalid and AllowDecimal is true.

C#
[DataMember]
public double DefaultDecimalValue { get; set; }

When true, displays up and down buttons at the end of the box.

C#
[DataMember]
public bool ShowUpDownButtons { get; set; }

Sets the up button’s value step.

C#
[DataMember]
public long UpButtonStep { get; set; }

Sets the down button’s value step.

C#
[DataMember]
public long DownButtonStep { get; set; }

Sets the up button’s value step when AllowDecimal is on.

C#
[DataMember]
public double UpButtonStepDecimal { get; set; }

Sets the down button’s value step when AllowDecimal is on.

C#
[DataMember]
public double DownButtonStepDecimal { get; set; }

When true, indicates that the number is either out of bounds of the NumberMinimum and NumberMaximum range, or it can’t be property parsed. Otherwise, false

C#
public bool IsEditingNumberInvalid { get; }

Used by the theme system.

Used by the mouse logic.

C#
public bool State_IsMouseOverUpButton { get; set; }

Used by the mouse logic.

C#
public bool State_IsMouseOverDownButton { get; set; }

The color to use with a NumberBox control when IsEditingNumberInvalid is true.

C#
[DataMember]
public Color? NumberBoxInvalidNumberForeground { get; set; }

The glyph for the up button.

C#
[DataMember]
public int UpButtonGlyph { get; set; }

The glyph for the down button.

C#
[DataMember]
public int DownButtonGlyph { get; set; }

Increases the number stored in the Text property by the specified amount.

C#
public void IncreaseNumber(long amount)

amount long
The amount.

Increases the number stored in the Text property by the specified amount.

C#
public void IncreaseNumber(double amount)

amount double
The amount.

Exception
Thrown when this method is used and the AllowDecimal property is set to false.

Decreases the number stored in the Text property by the specified amount.

C#
public void DecreaseNumber(long amount)

amount long
The amount.

Decreases the number stored in the Text property by the specified amount.

C#
public void DecreaseNumber(double amount)

amount double
The amount.

Exception
Thrown when this method is used and the AllowDecimal property is set to false.

Called when the control is focused.

C#
protected override void OnFocused()

Called when the control loses focus.

C#
protected override void OnUnfocused()

Returns the Text property as parsed by TryParse(string, NumberStyles, IFormatProvider, out long) with the current culture.

C#
public long TextAsLong()

long
The parsed text value.

Returns the Text property as parsed by TryParse(string, NumberStyles, IFormatProvider, out double) with the current culture.

C#
public double TextAsDouble()

double
The parsed text value.

Called when the control should process keyboard information.

C#
public override bool ProcessKeyboard(Keyboard info)

info Keyboard
The keyboard information.

bool
True if the keyboard was handled by this control.

Checks if the mouse is the control and calls the appropriate mouse methods.

C#
public override bool ProcessMouse(MouseScreenObjectState state)

state MouseScreenObjectState
Mouse information.

bool
True when the control is enabled, set to use the mouse and the mouse is over it, otherwise false.

Called when Resize(int, int) was called.

C#
protected override void OnResized()

Gets the current culture’s decimal separator.

C#
protected char GetCultureDecimalSeperator()

char
The current culture.

Returns the current culture.

C#
protected CultureInfo GetCulture()

CultureInfo
The current culture.

Redraws the control if applicable.

C#
public override void UpdateAndRedraw(TimeSpan time)

time TimeSpan
The duration of thecurrent frame.