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, 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 }