/// <summary> /// 入力ダイアログ /// </summary> /// <returns></returns> protected override bool DoInput() { bool ret = false; string msgfmt = CommonProc.MessageText("G003"); msgfmt = msgfmt.Replace("%param", ParamName); msgfmt = msgfmt.Replace("%length", MaxLength.ToString()); if (AllowJapanese) { IMEInputTextDialog tdlg = new IMEInputTextDialog(); tdlg.InputText = frontend.Text; tdlg.Caption = msgfmt; tdlg.MaxLength = MaxLength; if (tdlg.ShowDialog() == DialogResult.OK) { frontend.Text = tdlg.InputText; ret = true; } tdlg.Dispose(); } else { KeyboardDialog kdlg = new KeyboardDialog(); kdlg.InputArea = frontend.Text; kdlg.Message_Text = msgfmt; kdlg.DispMode = 0; //テキスト if (kdlg.ShowDialog() == DialogResult.OK) { frontend.Text = kdlg.InputArea; ret = true; } kdlg.Dispose(); } return(ret); }
/// <summary> /// マウスクリックイベントオーバーライド /// </summary> protected override bool InputValue() { bool res = false; KeyboardDialog kdlg = new KeyboardDialog(); kdlg.ValLower = MinValue; kdlg.ValUpper = MaxValue; kdlg.DispMode = KeyboardDialog.KB_MODE.NUMBER; string strrange = MaxValue.ToString(strForm); int digits = strrange.IndexOf('.'); kdlg.LengthInt = (digits < 0) ? strrange.Length : digits; kdlg.LengthDec = (digits < 0) ? 0 : (strrange.Length - digits - 1); kdlg.AllLength = strrange.Length; string msgfmt = CommonProc.MessageText("G001"); msgfmt = msgfmt.Replace("%param", paramName); msgfmt = msgfmt.Replace("%min", MinValue.ToString(strForm)); msgfmt = msgfmt.Replace("%max", MaxValue.ToString(strForm)); kdlg.Message_Text = msgfmt; kdlg.InputArea = Text; if (kdlg.ShowDialog() == DialogResult.OK) { Value = double.Parse(kdlg.InputArea); res = true; } kdlg.Dispose(); Invalidate(); return(res); }
private void CustomControl_UpDown_SizeChanged(object sender, EventArgs e) { // 角丸長方形のGraphicsPathを作成します。 GraphicsPath path = CommonProc.GetRoundRect(DisplayRectangle, 5); //Panelの形を角丸長方形に変更 this.Region = new Region(path); }
private void buttonText_Paint(object sender, PaintEventArgs e) { Rectangle rect = new Rectangle(0, 0, this.Width, this.Height); GraphicsPath path = CommonProc.GetRoundRect(rect, 5); //ペン作成 Pen linePen = new Pen(Color.Black, 2); // フォームに描画します。 e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.DrawPath(linePen, path); //ペン削除 linePen.Dispose(); }
/// <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 CustomControl_UpDown_Paint(object sender, PaintEventArgs e) { // フォームに描画します。 e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.DrawPath(new Pen(Color.Black, 2.0f), CommonProc.GetRoundRect(DisplayRectangle, 5)); }
/// <summary> /// マウスクリックイベントオーバーライド /// </summary> protected override bool InputValue() { bool res = false; if (!ReadOnly) { if (Items.Length == 2) {//トグルモード Text = Items[(ItemIndex + 1) & 1]; res = true; } else { CustomDialog.SelectItemDialog sdlg = null; if (Items.Length <= 3) { sdlg = new CustomDialog.SelectItem3Dialog(); } else if (3 < Items.Length && Items.Length <= 5) {//4~5項目 int maxlen = 0; foreach (string item in Items) { maxlen = Math.Max(maxlen, item.Length); } if (Items.Length == 4 && maxlen < 5) { sdlg = new CustomDialog.SelectItem4Dialog(); } else { sdlg = new CustomDialog.SelectItem5Dialog(); } } else if (Items.Length <= 10) {//6~10項目 sdlg = new CustomDialog.SelectItem10Dialog(); } if (sdlg != null) { sdlg.Items = Items; sdlg.Select(Text); string msgfmt = CommonProc.MessageText("G005"); msgfmt = msgfmt.Replace("%param", paramName); sdlg.Caption = msgfmt; if (ItemValids != null) { for (int i = 0; i < ItemValids.Length; i++) { sdlg.ButtonEnable(i, ItemValids[i]); } } if (sdlg.ShowDialog() == DialogResult.OK) { Text = sdlg.SelectedText; res = true; } sdlg.Dispose(); } } } return(res); }