/// <summary> /// マウスクリックイベントオーバーライド /// </summary> protected override bool InputValue() { bool res = false; if (!readOnly) { CustomDialog.KeyboardDialog kdlg = new CustomDialog.KeyboardDialog(); kdlg.DispMode = dateOnly ? KeyboardDialog.KB_MODE.DATEONLY : KeyboardDialog.KB_MODE.DATE; kdlg.TimeResolution = nosec ? 1 : 0; kdlg.TimeMin = RangeMin; kdlg.TimeMax = RangeMax; string msgfmt = CommonProc.MessageText(dateOnly ? "G006" : (nosec ? "G011" : "G002")); msgfmt = msgfmt.Replace("%param", paramName); kdlg.Message_Text = msgfmt; if (allowNone && Text == "") { kdlg.InputArea = ""; } else { kdlg.InputArea = internalDateTime.ToString(dateOnly ? "yyyyMMdd" : (nosec ? "yyyyMMddHHmm" : "yyyyMMddHHmmss")); } kdlg.AllowNone = allowNone; if (kdlg.ShowDialog() == DialogResult.OK) { if (allowNone && kdlg.InputArea == "") { Text = ""; valueIsNone = true; internalDateTime = DateTime.MinValue; } else { Text = dateOnly ? CommonProc.DateString(kdlg.InputArea) : CommonProc.DatetimeString(kdlg.InputArea); internalDateTime = DateTime.Parse(Text); valueIsNone = false; } res = true; } kdlg.Dispose(); } return(res); }
/// <summary> /// マウスクリックイベントオーバーライド /// </summary> protected override bool InputValue() { bool res = false; if (!readOnly) { CustomDialog.KeyboardDialog kdlg = new CustomDialog.KeyboardDialog(); kdlg.DispMode = KeyboardDialog.KB_MODE.TIME; string msgfmt = CommonProc.MessageText(nosec ? "G009" : "G008"); msgfmt = msgfmt.Replace("%param", paramName); kdlg.Message_Text = msgfmt; if (allowNone && Text == "") { kdlg.InputArea = ""; } else { kdlg.InputArea = internalTimeSpan.ToString(nosec ? "HHmm" : "HHmmss"); } kdlg.AllowNone = allowNone; if (kdlg.ShowDialog() == DialogResult.OK) { if (allowNone && kdlg.InputArea == "") { Text = ""; valueIsNone = true; internalTimeSpan = TimeSpan.MinValue; } else { Text = CommonProc.DatetimeString(kdlg.InputArea); internalTimeSpan = TimeSpan.Parse(Text); valueIsNone = false; } res = true; } kdlg.Dispose(); } return(res); }
/// <summary> /// マウスクリックイベントオーバーライド /// </summary> protected override bool InputValue() { bool res = false; if (!readOnly) { string msgfmt = CommonProc.MessageText("G003"); msgfmt = msgfmt.Replace("%param", paramName); msgfmt = msgfmt.Replace("%length", MaxLength.ToString()); if (AllowJapanese) { CustomDialog.IMEInputTextDialog tdlg = new CustomDialog.IMEInputTextDialog(); tdlg.InputText = Text; tdlg.Caption = msgfmt; tdlg.MaxLength = MaxLength; if (tdlg.ShowDialog() == DialogResult.OK) { Text = tdlg.InputText; res = true; } tdlg.Dispose(); } else { CustomDialog.KeyboardDialog kdlg = new CustomDialog.KeyboardDialog(); kdlg.InputArea = Text; kdlg.Message_Text = msgfmt; kdlg.DispMode = 0; //テキスト kdlg.AllLength = MaxLength; if (kdlg.ShowDialog() == DialogResult.OK) { Text = kdlg.InputArea; res = true; } kdlg.Dispose(); } } return(res); }
private void buttonText_Click(object sender, EventArgs e) { CustomDialog.KeyboardDialog kdlg = new CustomDialog.KeyboardDialog(); kdlg.ValLower = RangeMin; kdlg.ValUpper = RangeMax; kdlg.DispMode = KeyboardDialog.KB_MODE.NUMBER; //数値 string strrange = RangeMax.ToString(StringForm); int digits = strrange.IndexOf('.'); kdlg.LengthInt = (digits < 0) ? strrange.Length : digits; kdlg.LengthDec = (digits < 0) ? 0 : (strrange.Length - digits - 1); kdlg.AllLength = Math.Max(strrange.Length, RangeMin.ToString(StringForm).Length); string msgfmt = CommonProc.MessageText("G001"); msgfmt = msgfmt.Replace("%param", paramName); msgfmt = msgfmt.Replace("%min", RangeMin.ToString(StringForm)); msgfmt = msgfmt.Replace("%max", RangeMax.ToString(StringForm)); kdlg.Message_Text = msgfmt; kdlg.InputArea = _buttonText.Text; kdlg.AllowNone = allowNone; if (kdlg.ShowDialog() == DialogResult.OK) { if (allowNone && kdlg.InputArea == "") { Value = double.NaN; } else { Value = double.Parse(kdlg.InputArea); } if (ValueChanged != null) { ValueChanged(sender, e); } } kdlg.Dispose(); Invalidate(); }
/// <summary> /// マウスクリックイベントオーバーライド /// </summary> protected override bool InputValue() { bool res = false; if (!readOnly) { CustomDialog.KeyboardDialog kdlg = new CustomDialog.KeyboardDialog(); kdlg.InputArea = Value; string msgfmt = CommonProc.MessageText("G007"); msgfmt = msgfmt.Replace("%param", paramName); msgfmt = msgfmt.Replace("%length", MaxLength.ToString()); kdlg.Message_Text = msgfmt; kdlg.DispMode = KeyboardDialog.KB_MODE.MASK; //パスワード kdlg.AllLength = MaxLength; if (kdlg.ShowDialog() == DialogResult.OK) { Value = kdlg.InputArea; res = true; } kdlg.Dispose(); } return(res); }