private void SelectDict(UcTextBox textBox, string itemCode) { frmSearchDict frmSearchDict = new frmSearchDict(true); frmSearchDict.ItemCode = itemCode; if (textBox.Text.Length > 0) { frmSearchDict.NoItemValue = textBox.Text.Split(','); } frmSearchDict.BringToFront(); if (DialogResult.OK == frmSearchDict.ShowDialog()) { List <SYS_DictItemLineResult> rstList = frmSearchDict.GetSelectList <SYS_DictItemLineResult>(); if (rstList != null && rstList.Count > 0) { if (textBox.Text.Length > 0) { textBox.Text = textBox.Text + "," + string.Join(",", rstList.Select(a => a.ItemValue2).ToArray()); } else { textBox.Text = string.Join(",", rstList.Select(a => a.ItemValue2).ToArray()); } } } }
void SetTextDataType(string dataType, bool isMuti, string idConName, UcTextBox txt) { if (dataType == null) { return; } dataType = dataType.ToLower(); if (dataType != "") { txt.ButtonCustom.Visible = true; txt.ButtonCustom.Text = "..."; txt.ButtonCustom2.Visible = true; txt.ButtonCustom2.Text = "X"; } if (dataType == "employeselect")//人员选择 { txt.ButtonCustomClick += new EventHandler(txtEmpSlk_ButtonCustomClick); txt.ButtonCustom2Click += new EventHandler(txtEmpSlc_ButtonCustom2Click); } if (dataType == "supplierselect")//供应商选择 { txt.ButtonCustomClick += new EventHandler(txtEmpSlk_ButtonCustomClick); txt.ButtonCustom2Click += new EventHandler(txtEmpSlc_ButtonCustom2Click); } if (dataType == "customerselect")//客户选择 { txt.ButtonCustomClick += new EventHandler(txtEmpSlk_ButtonCustomClick); txt.ButtonCustom2Click += new EventHandler(txtEmpSlc_ButtonCustom2Click); } }
void CreateTextBox(XmlNode node, Control container) { string engName = node.Attributes["Name"] != null ? node.Attributes["Name"].Value : ""; string chsName = node.Attributes["CHName"] != null ? node.Attributes["CHName"].Value : ""; string dataType = node.Attributes["DataType"] != null ? node.Attributes["DataType"].Value : ""; bool isMuti = node.Attributes["IsMuti"] != null ? node.Attributes["IsMuti"].Value.ToBooleanHasNull() : false; string idConName = node.Attributes["IDConName"] != null ? node.Attributes["IDConName"].Value : ""; int w = node.Attributes["Width"] != null ? node.Attributes["Width"].Value.ToInt32() : 80; int h = node.Attributes["Height"] != null ? node.Attributes["Height"].Value.ToInt32() : 28; string defaultValue = node.Attributes["DefaultValue"] != null ? node.Attributes["DefaultValue"].Value : ""; ControlInfo conInfo = new ControlInfo(_form); #region 标题 if (chsName != "") { UcLabelX label = new UcLabelX(); label.Name = "lbl" + engName; label.Text = chsName; label.AutoSize = true; conInfo.LabelControl = label; } #endregion #region 隐藏的控件 UcTextBox txtHid = new UcTextBox(); txtHid.Name = idConName; txtHid.Visible = false; conInfo.HidInputControl = txtHid; #endregion #region 创建文本控件 UcTextBox txt = new UcTextBox(); txt.Name = engName; txt.Width = w; txt.Border.Class = "TextBoxBorder"; conInfo.InputControl = txt; conInfo.KeyName = container.Name; if (!_dicControl.ContainsKey(engName)) { _dicControl.Add(engName, conInfo); } #endregion #region 属性行为控制 defaultValue = GetDefaultValue(defaultValue); if (defaultValue != null) { txt.Text = defaultValue; } SetTextDataType(dataType, isMuti, idConName, txt); #endregion }
/// <summary> /// 伝票番号でキーが押された時のイベント処理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void c伝票番号_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter || e.Key == Key.Tab) { UcTextBox tb = sender as UcTextBox; if (string.IsNullOrEmpty(tb.Text)) { return; } // 検索項目検証 if (!isKeyItemValidation()) { tb.Focus(); return; } // 全項目エラーチェック if (!base.CheckKeyItemValidation()) { tb.Focus(); return; } // 入力伝票番号で検索 base.SendRequest( new CommunicationObject( MessageType.RequestData, T03_GetData, new object[] { this.c会社名.Text1, tb.Text, ccfg.ユーザID })); } }