Пример #1
0
        void tsbSearch_Click(object sender, EventArgs e)
        {
            frmSearch frmSearch = new frmSearch();
            Form      frm       = this.Parent.FindForm().GetType().Name == "frmMain" ? this.Parent.FindForm().ActiveMdiChild : this.Parent.FindForm();

            // Tim form tren tabcontrol
            if (frm == null)
            {
                frm = Common.FindFormChildInTab();
            }

            if (frm == null)
            {
                return;
            }

            object ExportControl = ((frmBase)frm).ExportControl;

            if (ExportControl == null)
            {
                return;
            }

            //dgvControl
            if (Common.Inlist(ExportControl.GetType().Name, "dgvControl,dgvReport,dgvVoucher"))
            {
                dgvControl dgv = (dgvControl)ExportControl;

                frmSearch.bdsSearch = (BindingSource)dgv.DataSource;
            }
            else if (Common.Inlist(ExportControl.GetType().Name, "tlControl,tlReport"))
            {
                tlControl tl = (tlControl)ExportControl;
                frmSearch.bdsSearch = (BindingSource)tl.DataSource;
            }
            frmSearch.Show();
        }
Пример #2
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.F2:
                if (e.Modifiers == Keys.None)
                {
                    Edit(enuEdit.New);
                }
                else if (e.Control)
                {
                    Edit(enuEdit.Copy);
                }

                return;

            case Keys.N:
                if (e.Control)
                {
                    Edit(enuEdit.New);
                }
                return;

            case Keys.F3:
                if (e.Modifiers == Keys.None)
                {
                    Edit(enuEdit.Edit);
                }

                return;

            case Keys.F6:
                if (e.Modifiers == Keys.None)
                {
                    MergeID();
                }

                return;

            case Keys.F8:
                if (e.Modifiers == Keys.None)
                {
                    Delete();
                }

                return;

            case Keys.D:
                if (e.Control)
                {
                    if (e.Modifiers == Keys.None)
                    {
                        Delete();
                    }
                }
                return;

            case Keys.F11:
                if (e.Modifiers == Keys.None)
                {
                    EditHanTt();
                }

                return;

            case Keys.Enter:
                EnterProcess();
                return;

            case Keys.Escape:
                this.bIsEnter = false;
                if (this.FormBorderStyle == FormBorderStyle.None)
                {
                    Common.CloseCurrentFormOnMain();
                }
                //if (!isLookup)
                //    Common.CloseCurrentFormOnMain();
                this.Close();
                //Common.CloseCurrentForm();
                return;

            case Keys.F4:
                if (e.Modifiers == Keys.None)
                {
                    if ((Control)this.ExportControl == null)
                    {
                        return;
                    }

                    if (this.MdiParent != null && this.MdiParent.IsMdiContainer)
                    {
                        if (((Epoint.Systems.Customizes.frmMain) this.MdiParent).tsView.Visible == true)
                        {
                            if (this.ActiveControl == splitContainer || this.ActiveControl == ExportControl)
                            {
                                ((Epoint.Systems.Customizes.frmMain) this.MdiParent).tsView.txtFilter.Focus();
                            }
                            else
                            {
                                ((Control)this.ExportControl).Focus();
                            }
                        }
                    }
                    else
                    {
                        if (this.ActiveControl == splitContainer || this.ActiveControl == ExportControl)
                        {
                            this.tsView.txtFilter.Focus();
                        }
                        else
                        {
                            ((Control)this.ExportControl).Focus();
                        }
                    }
                }

                return;

            case Keys.F:
                if (e.Control)
                {
                    frmsearch.iCurrentPotition = this.bdsSearch.Position;
                    frmsearch.bdsSearch        = this.bdsSearch;
                    frmsearch.Show();
                }
                break;

            case Keys.G:
                if (e.Control)
                {
                    frmsearch.bdsSearch = this.bdsSearch;
                    frmsearch.GoNext();
                }
                break;
            }

            base.OnKeyDown(e);
        }