NumberBox Class
Definition
Section titled “Definition”InputBox control that allows text input.
[DataContract]public class NumberBox : TextBoxInheritance object → ControlBase → TextBox
Constructors
Section titled “Constructors”NumberBox(int)
Section titled “NumberBox(int)”Creates a new instance of the input box.
public NumberBox(int width)Parameters
Section titled “Parameters”width int
The width of the input box.
Fields
Section titled “Fields”_allowDecimalPoint
Section titled “_allowDecimalPoint”Indicates that the input box (when numeric) will accept decimal points.
[DataMember(Name = "AllowDecimalPoint")]protected bool _allowDecimalPointProperties
Section titled “Properties”AllowDecimal
Section titled “AllowDecimal”Gets or sets whether or not this input box should restrict numeric input should allow a decimal point.
public bool AllowDecimal { get; set; }NumberMaximum
Section titled “NumberMaximum”The maximum number that can be set for this text box.
[DataMember]public long NumberMaximum { get; set; }Remarks
Section titled “Remarks”Set both NumberMaximum and NumberMinimum to 0 to disable number bounds checking.
NumberMinimum
Section titled “NumberMinimum”The minimum number that can be set for this text box.
[DataMember]public long NumberMinimum { get; set; }Remarks
Section titled “Remarks”Set both NumberMaximum and NumberMinimum to 0 to disable number bounds checking.
DefaultValue
Section titled “DefaultValue”The default value to use when the current value is invalid and AllowDecimal is false.
[DataMember]public long DefaultValue { get; set; }DefaultDecimalValue
Section titled “DefaultDecimalValue”The default value to use when the current value is invalid and AllowDecimal is true.
[DataMember]public double DefaultDecimalValue { get; set; }ShowUpDownButtons
Section titled “ShowUpDownButtons”When true, displays up and down buttons at the end of the box.
[DataMember]public bool ShowUpDownButtons { get; set; }UpButtonStep
Section titled “UpButtonStep”Sets the up button’s value step.
[DataMember]public long UpButtonStep { get; set; }DownButtonStep
Section titled “DownButtonStep”Sets the down button’s value step.
[DataMember]public long DownButtonStep { get; set; }UpButtonStepDecimal
Section titled “UpButtonStepDecimal”Sets the up button’s value step when AllowDecimal is on.
[DataMember]public double UpButtonStepDecimal { get; set; }DownButtonStepDecimal
Section titled “DownButtonStepDecimal”Sets the down button’s value step when AllowDecimal is on.
[DataMember]public double DownButtonStepDecimal { get; set; }IsEditingNumberInvalid
Section titled “IsEditingNumberInvalid”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
public bool IsEditingNumberInvalid { get; }Remarks
Section titled “Remarks”Used by the theme system.
State_IsMouseOverUpButton
Section titled “State_IsMouseOverUpButton”Used by the mouse logic.
public bool State_IsMouseOverUpButton { get; set; }State_IsMouseOverDownButton
Section titled “State_IsMouseOverDownButton”Used by the mouse logic.
public bool State_IsMouseOverDownButton { get; set; }NumberBoxInvalidNumberForeground
Section titled “NumberBoxInvalidNumberForeground”The color to use with a NumberBox control when IsEditingNumberInvalid is true.
[DataMember]public Color? NumberBoxInvalidNumberForeground { get; set; }UpButtonGlyph
Section titled “UpButtonGlyph”The glyph for the up button.
[DataMember]public int UpButtonGlyph { get; set; }DownButtonGlyph
Section titled “DownButtonGlyph”The glyph for the down button.
[DataMember]public int DownButtonGlyph { get; set; }Methods
Section titled “Methods”IncreaseNumber(long)
Section titled “IncreaseNumber(long)”Increases the number stored in the Text property by the specified amount.
public void IncreaseNumber(long amount)Parameters
Section titled “Parameters”amount long
The amount.
IncreaseNumber(double)
Section titled “IncreaseNumber(double)”Increases the number stored in the Text property by the specified amount.
public void IncreaseNumber(double amount)Parameters
Section titled “Parameters”amount double
The amount.
Exceptions
Section titled “Exceptions”Exception
Thrown when this method is used and the AllowDecimal property is set to false.
DecreaseNumber(long)
Section titled “DecreaseNumber(long)”Decreases the number stored in the Text property by the specified amount.
public void DecreaseNumber(long amount)Parameters
Section titled “Parameters”amount long
The amount.
DecreaseNumber(double)
Section titled “DecreaseNumber(double)”Decreases the number stored in the Text property by the specified amount.
public void DecreaseNumber(double amount)Parameters
Section titled “Parameters”amount double
The amount.
Exceptions
Section titled “Exceptions”Exception
Thrown when this method is used and the AllowDecimal property is set to false.
OnFocused()
Section titled “OnFocused()”Called when the control is focused.
protected override void OnFocused()OnUnfocused()
Section titled “OnUnfocused()”Called when the control loses focus.
protected override void OnUnfocused()TextAsLong()
Section titled “TextAsLong()”Returns the Text property as parsed by TryParse(string, NumberStyles, IFormatProvider, out long) with the current culture.
public long TextAsLong()Returns
Section titled “Returns”long
The parsed text value.
TextAsDouble()
Section titled “TextAsDouble()”Returns the Text property as parsed by TryParse(string, NumberStyles, IFormatProvider, out double) with the current culture.
public double TextAsDouble()Returns
Section titled “Returns”double
The parsed text value.
ProcessKeyboard(Keyboard)
Section titled “ProcessKeyboard(Keyboard)”Called when the control should process keyboard information.
public override bool ProcessKeyboard(Keyboard info)Parameters
Section titled “Parameters”info Keyboard
The keyboard information.
Returns
Section titled “Returns”bool
True if the keyboard was handled by this control.
ProcessMouse(MouseScreenObjectState)
Section titled “ProcessMouse(MouseScreenObjectState)”Checks if the mouse is the control and calls the appropriate mouse methods.
public override bool ProcessMouse(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
Mouse information.
Returns
Section titled “Returns”bool
True when the control is enabled, set to use the mouse and the mouse is over it, otherwise false.
OnResized()
Section titled “OnResized()”Called when Resize(int, int) was called.
protected override void OnResized()GetCultureDecimalSeperator()
Section titled “GetCultureDecimalSeperator()”Gets the current culture’s decimal separator.
protected char GetCultureDecimalSeperator()Returns
Section titled “Returns”char
The current culture.
GetCulture()
Section titled “GetCulture()”Returns the current culture.
protected CultureInfo GetCulture()Returns
Section titled “Returns”CultureInfo
The current culture.
UpdateAndRedraw(TimeSpan)
Section titled “UpdateAndRedraw(TimeSpan)”Redraws the control if applicable.
public override void UpdateAndRedraw(TimeSpan time)Parameters
Section titled “Parameters”time TimeSpan
The duration of thecurrent frame.