private void Form_main_Shown(object sender, EventArgs e) { Form_start f = new Form_start(); if (f.ShowDialog(this) != DialogResult.OK) { this.Close(); return; } if (Form_main.printerName != string.Empty) { printer.PrinterSettings.PrinterName = Form_main.printerName; isPrint = true; } this.toolStripStatusLabel2.Text = "是否打印小票【"; this.toolStripStatusLabel2.Text += isPrint ? "是】" : "否】"; this.toolStripStatusLabel1.Text = string.Format("当前收银员【{0}", worker.xm + "】"); var hWnd = FindWindow(null, "ClientSender"); if (IntPtr.Zero == hWnd) { try { this.Cursor = Cursors.WaitCursor; Process.Start(Application.StartupPath + "\\ClientSender.exe"); } catch (Exception se) { MessageBox.Show("启动ClientSender出错!\r\n" + se.Message); } finally { this.Cursor = Cursors.Default; } } }
private void textBox_tm_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { //回车键 case Keys.Enter: this.KeyEnter(); break; //删除表格中最后一行,如果表格为空,则清空会员信息 case Keys.Delete: if (this.textBox_tm.TextLength == 0) { if (this.dataGridView.RowCount > 0) { this.dataGridView.Rows.RemoveAt(this.dataGridView.RowCount - 1); this.Add(); } else { if (this.isHuiYuan) { this.ClearPeople(); } } } break; //F12 是否打印切换 case Keys.F12: isPrint = !isPrint; if (printer == null) { isPrint = false; } this.toolStripStatusLabel2.Text = isPrint ? "是否打印小票【是】" : "是否打印小票【否】"; break; //F10 更换收银员,此一功能针对一单笔中的一种商品而使用 case Keys.F10: Form_start f = new Form_start(); if (f.ShowDialog(this) == DialogResult.OK) { this.toolStripStatusLabel1.Text = string.Format("当前收银员【{0}】", worker.xm); } break; //删除表格中的指定行 case Keys.F11: if (this.dataGridView.RowCount > 0) { this.dataGridView.Select(); this.dataGridView.CurrentCell = this.dataGridView.Rows[0].Cells[0]; } break; // 退货操作 case Keys.T: TuiHuo(e); break; //增加商品数量 case Keys.Add: EditDataGridViewCurrentCroSL_Add(e); break; case Keys.Subtract: EditDataGridViewCurrentCroSL_Subtract(e); break; //编号商品金额 case Keys.E: EditJE(e); break; case Keys.Z: EditGoodsZQ(e); break; case Keys.H: if (e.Control) { Form_find_people people = new Form_find_people(); if (people.ShowDialog(this) == DialogResult.OK) { this.hybh = people.p.bh; this.hyxm = people.p.xm; this.hyjf = people.p.jf; this.isHuiYuan = true; this.zqfs = "会员"; this.statusLabel_huiyuan.Text = "当前顾客是否会员【是】,姓名【" + hyxm + "】,积分【" + hyjf.ToString() + "】"; } } break; default: break; } }