Esempio n. 1
0
        /// <summary>
        /// Handles the MouseDown event of the txtNum control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
        private void txtNum_MouseDown(object sender, MouseEventArgs e)
        {
            if (IsNumCanInput)
            {
                if (KeyBoardType != HZH_Controls.Controls.KeyBoardType.Null)
                {
                    switch (keyBoardType)
                    {
                    case KeyBoardType.UCKeyBorderAll_EN:

                        UCKeyBorderAll keyAll = new UCKeyBorderAll();
                        keyAll.RetractClike        += (a, b) => { m_frmAnchor.Hide(); };
                        keyAll.EnterClick          += (a, b) => { m_frmAnchor.Hide(); };
                        m_frmAnchor                 = new Forms.FrmAnchor(this, keyAll);
                        m_frmAnchor.VisibleChanged += m_frmAnchor_VisibleChanged;

                        m_frmAnchor.Show(this.FindForm());
                        break;

                    case KeyBoardType.UCKeyBorderNum:

                        UCKeyBorderNum keyNum = new UCKeyBorderNum();
                        keyNum.EnterClick          += (a, b) => { m_frmAnchor.Hide(); };
                        m_frmAnchor                 = new Forms.FrmAnchor(this, keyNum);
                        m_frmAnchor.VisibleChanged += m_frmAnchor_VisibleChanged;
                        m_frmAnchor.Show(this.FindForm());
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Handles the MouseDown event of the btnKeybord control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
        private void btnKeybord_MouseDown(object sender, MouseEventArgs e)
        {
            if (keyBoardType == HZH_Controls.Controls.KeyBoardType.Null)
            {
                return;
            }
            m_intSelectionStart           = this.txtInput.SelectionStart;
            m_intSelectionLength          = this.txtInput.SelectionLength;
            this.FindForm().ActiveControl = this;
            this.FindForm().ActiveControl = this.txtInput;
            switch (keyBoardType)
            {
            case KeyBoardType.UCKeyBorderAll_EN:
                if (m_frmAnchor == null)
                {
                    if (m_frmAnchor == null)
                    {
                        UCKeyBorderAll key = new UCKeyBorderAll();
                        key.CharType      = KeyBorderCharType.CHAR;
                        key.RetractClike += (a, b) =>
                        {
                            m_frmAnchor.Hide();
                        };
                        m_frmAnchor = new Forms.FrmAnchor(this, key);
                        m_frmAnchor.VisibleChanged += (a, b) =>
                        {
                            if (m_frmAnchor.Visible)
                            {
                                this.txtInput.SelectionStart  = m_intSelectionStart;
                                this.txtInput.SelectionLength = m_intSelectionLength;
                            }
                        };
                    }
                }
                break;

            case KeyBoardType.UCKeyBorderAll_Num:

                if (m_frmAnchor == null)
                {
                    UCKeyBorderAll key = new UCKeyBorderAll();
                    key.CharType      = KeyBorderCharType.NUMBER;
                    key.RetractClike += (a, b) =>
                    {
                        m_frmAnchor.Hide();
                    };
                    m_frmAnchor = new Forms.FrmAnchor(this, key);
                    m_frmAnchor.VisibleChanged += (a, b) =>
                    {
                        if (m_frmAnchor.Visible)
                        {
                            this.txtInput.SelectionStart  = m_intSelectionStart;
                            this.txtInput.SelectionLength = m_intSelectionLength;
                        }
                    };
                }

                break;

            case KeyBoardType.UCKeyBorderNum:
                if (m_frmAnchor == null)
                {
                    UCKeyBorderNum key = new UCKeyBorderNum();
                    m_frmAnchor = new Forms.FrmAnchor(this, key);
                    m_frmAnchor.VisibleChanged += (a, b) =>
                    {
                        if (m_frmAnchor.Visible)
                        {
                            this.txtInput.SelectionStart  = m_intSelectionStart;
                            this.txtInput.SelectionLength = m_intSelectionLength;
                        }
                    };
                }
                break;

            case HZH_Controls.Controls.KeyBoardType.UCKeyBorderHand:

                m_frmAnchor = new Forms.FrmAnchor(this, new Size(504, 361));
                m_frmAnchor.VisibleChanged += m_frmAnchor_VisibleChanged;
                m_frmAnchor.Disposed       += m_frmAnchor_Disposed;
                Panel p = new Panel();
                p.Dock = DockStyle.Fill;
                p.Name = "keyborder";
                m_frmAnchor.Controls.Add(p);

                UCBtnExt btnDelete = new UCBtnExt();
                btnDelete.Name        = "btnDelete";
                btnDelete.Size        = new Size(80, 28);
                btnDelete.FillColor   = Color.White;
                btnDelete.IsRadius    = false;
                btnDelete.ConerRadius = 1;
                btnDelete.IsShowRect  = true;
                btnDelete.RectColor   = Color.FromArgb(189, 197, 203);
                btnDelete.Location    = new Point(198, 332);
                btnDelete.BtnFont     = new System.Drawing.Font("微软雅黑", 8);
                btnDelete.BtnText     = "删除";
                btnDelete.BtnClick   += (a, b) =>
                {
                    SendKeys.Send("{BACKSPACE}");
                };
                m_frmAnchor.Controls.Add(btnDelete);
                btnDelete.BringToFront();

                UCBtnExt btnEnter = new UCBtnExt();
                btnEnter.Name        = "btnEnter";
                btnEnter.Size        = new Size(82, 28);
                btnEnter.FillColor   = Color.White;
                btnEnter.IsRadius    = false;
                btnEnter.ConerRadius = 1;
                btnEnter.IsShowRect  = true;
                btnEnter.RectColor   = Color.FromArgb(189, 197, 203);
                btnEnter.Location    = new Point(278, 332);
                btnEnter.BtnFont     = new System.Drawing.Font("微软雅黑", 8);
                btnEnter.BtnText     = "确定";
                btnEnter.BtnClick   += (a, b) =>
                {
                    SendKeys.Send("{ENTER}");
                    m_frmAnchor.Hide();
                };
                m_frmAnchor.Controls.Add(btnEnter);
                btnEnter.BringToFront();
                m_frmAnchor.VisibleChanged += (a, b) =>
                {
                    if (m_frmAnchor.Visible)
                    {
                        this.txtInput.SelectionStart  = m_intSelectionStart;
                        this.txtInput.SelectionLength = m_intSelectionLength;
                    }
                };
                break;
            }
            if (!m_frmAnchor.Visible)
            {
                m_frmAnchor.Show(this.FindForm());
            }
            if (KeyboardClick != null)
            {
                KeyboardClick(sender, e);
            }
        }