public static object GetObject(string name) { ExceptionResources loader = GetLoader(); return(loader.resources.GetObject(name + "." + Culture.TwoLetterISOLanguageName) ?? loader.resources.GetString(name)); }
/// <summary> /// フォーカスを失った時、数値をフォーマット化する。 /// NOTE: NumericUpDown コントロールに準拠し、ウィンドウから離れた場合に値が確定されるようにする。 /// </summary> /// <param name="e"></param> protected override void OnLostFocus(EventArgs e) { this.leavedSelectionStart = this.SelectionStart; this.leavedSelectionLength = this.SelectionLength; // 小数記号、負数記号しか入力がない場合は空文字を見なす if (base.Text == "." || base.Text == "-") { this.textFormatting = true; base.Text = ""; this.textFormatting = false; } // 入力値を保存し、フォーマットされた値で描画しなおす if (string.IsNullOrEmpty(base.Text)) { if (this.AcceptNull) { this.value = null; } else { this.value = MinValue; } } else { this.value = decimal.Parse(base.Text); } // NOTE: isValidRangeValue() によって値が範囲外の場合は強制的に最小値/最大値とする if (value > MaxValue) { this.value = this.MaxValue; } if (value < MinValue) { this.value = this.MinValue; } // 内部値と異なるもしくは、フォーカスを得た時に値が入っており、nullに変更した場合に変化があったとする if ((this.value != this.internalValue) || (this.value == null && this.internalValue == null && this.enterValue != null)) { this.internalValue = this.value; // 入力値チェックイベント var e2 = new TextChangeValidationEventArgs(); e2.Cancel = false; e2.Before = this.value.ToString(); e2.Input = value.ToString(); e2.After = value.ToString(); this.OnTextChangeValidation(e2); if (e2.Cancel) { throw new DeniedTextException( ExceptionResources.GetString("DeniedTextException"), value.ToString()); } OnValueChanged(new EventArgs()); } this.textFormatting = true; base.Text = this.createFormattedText(this.value); this.textFormatting = false; this.ChangeDisplayColor(); base.OnLostFocus(e); }