///////////////////////////////////////////KEY Event /////////////////////////////////////////// /// <summary> /// * 함 수 명 : txt_KeyPress /// * 작 성 자 : 황지희 /// * 개 요 : key 이벤트 영어(대문자), 숫자만 입력받도록 valid 체크 /// </summary> private void txt_KeyPress(object sender, KeyPressEventArgs e) { TextBox txt = (TextBox)sender; Control temp = txt.Parent; MaskTextBox mtb = null; while (temp.Parent != null) { if (temp is MaskTextBox) { mtb = temp as MaskTextBox; break; } temp = temp.Parent; } if (mtb == null) { return; } switch (mtb.Name) { case "txt_MaskNum": CommonFuction.TypingOnlyEngNum(sender, e, txt_MaskNum); break; case "txt_NowUse": CommonFuction.TypingOnlyNumber(sender, e, false); break; case "txt_EqpId": CommonFuction.TypingOnlyEngNum(sender, e, txt_EqpId); break; } }
/// <summary> /// * 함 수 명 : TxtWidth_KeyPress /// * 개 요 : 숫자만 입력 가능 / 엔터 포커싱 /// </summary> /// private void TxtWidth_KeyPress(object sender, KeyPressEventArgs e) { CommonFuction.TypingOnlyNumber(sender, e, false); if (e.KeyChar == (char)Keys.Enter) { txtHeight.Focus(); } }
/// <summary> /// 텍스트박스 입력 키 제한,엔터키 입력시 TAB키 반환 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TxtText_KeyPress(object sender, KeyPressEventArgs e) { TextBox txt = (TextBox)sender; Control temp = txt.Parent; MaskTextBox mtb = null; while (temp.Parent != null) { if (temp is MaskTextBox) { mtb = temp as MaskTextBox; break; } temp = temp.Parent; } if (mtb == null) { return; } switch (mtb.Name) { case "txtProdId": CommonFuction.TypingOnlyEngNum(sender, e, txtProdId); if (e.KeyChar == (char)Keys.Enter) { SendKeys.Send("{TAB}"); } break; case "txtMaskThick": CommonFuction.TypingOnlyNumber(sender, e, true); if (e.KeyChar == (char)Keys.Enter) { SendKeys.Send("{TAB}"); } break; case "txtLimitUseQTY": case "txtWarningUseQTY": CommonFuction.TypingOnlyNumber(sender, e, false); if (e.KeyChar == (char)Keys.Enter) { SendKeys.Send("{TAB}"); } break; case "txtProdName": case "txtMaskSize": if (Char.IsLetter(e.KeyChar) == false && Char.IsDigit(e.KeyChar) == false && e.KeyChar != 8 && e.KeyChar == ',') { e.Handled = true; } if (e.KeyChar == (char)Keys.Enter) { SendKeys.Send("{TAB}"); } break; } }