示例#1
0
        void frmVoucher_Edit_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.F12:
            {
                if (e.Control)
                {
                    Epoint.Systems.Customizes.frmView frm = new Epoint.Systems.Customizes.frmView();
                    frm.Text = "Detail";

                    SplitContainer splc = new SplitContainer();
                    splc.Orientation      = Orientation.Horizontal;
                    splc.SplitterDistance = splc.Height / 3;
                    splc.Dock             = DockStyle.Fill;

                    DataGridView dgvPh = new DataGridView();
                    dgvPh.Dock               = DockStyle.Fill;
                    dgvPh.DataSource         = dtEditPh;
                    dgvPh.BackgroundColor    = Color.White;
                    dgvPh.AllowUserToAddRows = false;
                    splc.Panel1.Controls.Add(dgvPh);

                    DataGridView dgvCt = new DataGridView();
                    dgvCt.Dock               = DockStyle.Fill;
                    dgvCt.DataSource         = dtEditCt;
                    dgvCt.BackgroundColor    = Color.White;
                    dgvCt.AllowUserToAddRows = false;
                    splc.Panel2.Controls.Add(dgvCt);

                    frm.Controls.Add(splc);
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                break;
            }

            case Keys.F6:
                if ((e.Alt || e.Control) || e.Shift)
                {
                    if ((!e.Alt && e.Control) && !e.Shift)
                    {
                        Voucher.CopyNewRow(this);
                    }
                    break;
                }
                Voucher.AddRow(this);
                break;

            case Keys.S:
                if (e.Control)
                {
                    if (this.Save())
                    {
                        isAccept = true;

                        if ((enuNew_Edit == enuEdit.New || enuNew_Edit == enuEdit.Copy) && drDmCt.Table.Columns.Contains("Auto_New_Voucher") && (bool)drDmCt["Auto_New_Voucher"])
                        {
                            this.Load(enuEdit.New, drEdit, dsVoucher);
                        }
                        else
                        {
                            this.Close();
                        }
                        //base.ShowSuccessMessage("Thành công !");
                        //MessageBox.Show("Thành công !");
                    }
                }
                break;
            }
        }