public void Clear() { txtTemplateID.Text = ""; txtPointX.Text = ""; txtPointY.Text = ""; cbBold.Checked = false; txtFontSize.Clear(); txtHeight.Clear(); txtWidth.Clear(); txtRotation.Clear(); txtFontName.Clear(); txtPaperSizeHeight.Clear(); txtPaperSizeWidth.Clear(); txtTDescription.Clear(); }
private void txtCustomerID_KeyUp(object sender, KeyEventArgs e) { #region txtCustomerID if (sender == txtCustomerID) { Boolean IsF2 = false; if (e.KeyCode.ToString() == "F2") { if (oCustomer.View()) { IsF2 = true; this.txtCustomerID.Text = oCustomer.CustomerID; this.txtTeacher.Focus(); } this.txtName.Text = oCustomer.Name; icrProcessor.CustomerID = oCustomer.CustomerID; oOrder.oCustomer.Find(oCustomer.CustomerID); return; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab" || IsF2) { IsF2 = false; if (!oCustomer.Find(txtCustomerID.Text)) { this.txtCustomerID.Focus(); return; } txtName.Text = txtName.Text; icrProcessor.CustomerID = txtCustomerID.Text; this.txtTeacher.Focus(); return; } } #endregion #region txtTeacher if (sender == txtTeacher) { if (e.KeyCode.ToString() == "F2") { icrProcessor.oTeacher.CustomerID = txtCustomerID.Text; icrProcessor.oTeacher.View(); if (icrProcessor.oTeacher.Name != "") { this.txtTeacher.Text = icrProcessor.oTeacher.Name; icrProcessor.Teacher = icrProcessor.oTeacher.Name; this.LoadImageFiles(txtTeacher.Text); return; } } if (e.KeyCode == Keys.Enter || e.KeyCode.ToString() == "Tab") { if (txtCustomerID.Text.Trim() != "") { if (icrProcessor.oTeacher.Find(oOrder.CompanyID, oOrder.oCustomer.ID, txtTeacher.Text)) { this.txtTeacher.Text = icrProcessor.oTeacher.Name; icrProcessor.Teacher = txtTeacher.Text; this.LoadImageFiles(txtTeacher.Text); return; } else { txtTeacher.Clear(); txtTeacher.Focus(); return; } } } } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { //MessageBox.Show(e.KeyCode.ToString()); #region txtProductID if (sender == txtProductID) { if (e.KeyCode == Keys.F2) { if (oProduct.View()) { this.Display(); return; } txtProductID.Clear(); txtProductID.Focus(); return; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (txtProductID.Text.Trim() == "") { txtProductID.Clear(); txtProductID.Focus(); return; } if (oProduct.Find(txtProductID.Text)) { this.Display(); return; } else { return; } } } #endregion #region txtTemplateID if (sender == txtTemplateID) { if (e.KeyCode == Keys.F2) { if (oCardTemplate.View()) { txtTemplateID.Text = oCardTemplate.ID; txtTDescription.Text = oCardTemplate.Description; DisplayCard(); return; } //this.txtDescription.Text = return; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (txtTemplateID.Text.Trim() == "") { txtTemplateID.Clear(); txtTemplateID.Focus(); return; } if (oCardTemplate.Find(Convert.ToInt32(txtTemplateID.Text))) { txtTemplateID.Text = oCardTemplate.ID; txtTDescription.Text = oCardTemplate.Description; this.DisplayCard(); return; } else { return; } } } #endregion #region txtEnvTemplateID if (sender == txtEnvTemplateID) { if (e.KeyCode == Keys.F2) { if (oCardTemplate.View()) { txtEnvTemplateID.Text = oCardTemplate.ID; txtEDescription.Text = oCardTemplate.Description; DisplayCard(); return; } //this.txtDescription.Text = return; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (txtProductID.Text.Trim() == "") { txtEnvTemplateID.Clear(); txtEnvTemplateID.Focus(); return; } if (oCardTemplate.Find(Convert.ToInt32(txtEnvTemplateID.Text))) { txtEnvTemplateID.Text = oCardTemplate.ID; txtEDescription.Text = oCardTemplate.Description; this.DisplayCard(); return; } else { return; } } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F3: break; case Keys.PageDown: Save(); Clear(); txtProductID.Clear(); txtProductID.Focus(); txtProductID.Enabled = true; return; case Keys.Delete: break; //case Keys.<some key>: // ......; // break; } #endregion }