/// <summary> /// Display the floating point value /// </summary> private void ShowValue() { if ((this.value == double.MaxValue) || (this.value == double.MinValue)) { textEntry.Text = string.Empty; } else { textEntry.Text = string.Format("{0,2:f" + DecPlaces.ToString() + "}", this.value); } }
/// <summary> /// The handler for editing changes /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> private void OnChanged(object sender, EventArgs e) { if (textEntry.Text.Length > 0) { double result; if (double.TryParse(textEntry.Text, out result)) // TODO: need to check the ranges here and adjust the viewed value { value = result; } else { textEntry.Text = string.Format("{0,0:f" + DecPlaces.ToString() + "}", 0); } } if (OnChange != null) { EventArgs args = new EventArgs(); OnChange(this, args); } }