Esempio n. 1
0
        /// <summary>
        /// Handles the MouseDown event of the click control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
        protected override void click_MouseDown(object sender, MouseEventArgs e)
        {
            if (m_columns == null || m_columns.Count <= 0)
                return;
            if (m_ucPanel == null)
            {
                var p = this.Parent.PointToScreen(this.Location);
                int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
                int intHeight = Math.Max(p.Y, intScreenHeight - p.Y - this.Height);
                intHeight -= 100;
                m_ucPanel = new UCComboxGridPanel();
                m_ucPanel.ItemClick += m_ucPanel_ItemClick;
                m_ucPanel.Height = intHeight;
                m_ucPanel.Width = intWidth;
                m_ucPanel.Columns = m_columns;
                m_ucPanel.RowType = m_rowType;
                if (m_dataSource != null && m_dataSource.Count > 0)
                {
                    int _intHeight = Math.Min(110 + m_dataSource.Count * 36, m_ucPanel.Height);
                    if (_intHeight <= 0)
                        _intHeight = 100;
                    m_ucPanel.Height = _intHeight;
                }
            }
            m_ucPanel.DataSource = m_dataSource;
            if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
            {
                _frmAnchor = new Forms.FrmAnchor(this, m_ucPanel, isNotFocus: false);
                _frmAnchor.Show(this.FindForm());
            }

        }
Esempio n. 2
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;
                    }
                }
            }
        }
Esempio n. 3
0
        protected virtual void click_MouseDown(object sender, MouseEventArgs e)
        {
            if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
            {
                if (this.Source != null && this.Source.Count > 0)
                {
                    int intRow = 0;
                    int intCom = 1;
                    var p      = this.PointToScreen(this.Location);
                    while (true)
                    {
                        int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
                        if ((p.Y + this.Height + this.Source.Count / intCom * 50 < intScreenHeight || p.Y - this.Source.Count / intCom * 50 > 0) &&
                            (_dropPanelHeight <= 0 ? true : (this.Source.Count / intCom * 50 <= _dropPanelHeight)))
                        {
                            intRow = this.Source.Count / intCom + (this.Source.Count % intCom != 0 ? 1 : 0);
                            break;
                        }
                        intCom++;
                    }
                    UCTimePanel ucTime = new UCTimePanel();
                    ucTime.IsShowBorder = true;
                    int intWidth = this.Width / intCom;
                    if (intWidth < _ItemWidth)
                    {
                        intWidth = _ItemWidth;
                    }
                    Size size = new Size(intCom * intWidth, intRow * 50);
                    ucTime.Size               = size;
                    ucTime.FirstEvent         = true;
                    ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
                    ucTime.Row    = intRow;
                    ucTime.Column = intCom;
                    List <KeyValuePair <string, string> > lst = new List <KeyValuePair <string, string> >();
                    foreach (var item in this.Source)
                    {
                        lst.Add(new KeyValuePair <string, string>(item.Key, item.Value));
                    }
                    ucTime.Source = lst;

                    ucTime.SetSelect(_selectedValue);

                    _frmAnchor       = new Forms.FrmAnchor(this, ucTime);
                    _frmAnchor.Load += (a, b) => { (a as Form).Size = size; };

                    _frmAnchor.Show(this.FindForm());
                }
            }
            else
            {
                _frmAnchor.Close();
            }
        }
 void c_MouseDown(object sender, MouseEventArgs e)
 {
     if (m_selectPan == null)
     {
         m_selectPan = new UCDateTimeSelectPan();
         m_selectPan.SelectedTimeEvent += uc_SelectedTimeEvent;
         m_selectPan.CancelTimeEvent   += m_selectPan_CancelTimeEvent;
     }
     m_selectPan.CurrentTime = currentTime;
     m_selectPan.TimeType    = m_type;
     m_frmAnchor             = new Forms.FrmAnchor(this, m_selectPan);
     m_frmAnchor.Show(this.FindForm());
 }
Esempio n. 5
0
        /// <summary>
        /// Handles the BtnClick event of the UCDropDownBtn control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        void UCDropDownBtn_BtnClick(object sender, EventArgs e)
        {
            if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
            {
                if (Btns != null && Btns.Length > 0)
                {
                    int intRow = 0;
                    int intCom = 1;
                    var p      = this.PointToScreen(this.Location);
                    while (true)
                    {
                        int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
                        if ((p.Y + this.Height + Btns.Length / intCom * 50 < intScreenHeight || p.Y - Btns.Length / intCom * 50 > 0) &&
                            (_dropPanelHeight <= 0 ? true : (Btns.Length / intCom * 50 <= _dropPanelHeight)))
                        {
                            intRow = Btns.Length / intCom + (Btns.Length % intCom != 0 ? 1 : 0);
                            break;
                        }
                        intCom++;
                    }
                    UCTimePanel ucTime = new UCTimePanel();
                    ucTime.IsShowBorder = true;
                    int intWidth = this.Width / intCom;

                    Size size = new Size(intCom * intWidth, intRow * 50);
                    ucTime.Size               = size;
                    ucTime.FirstEvent         = true;
                    ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
                    ucTime.Row    = intRow;
                    ucTime.Column = intCom;

                    List <KeyValuePair <string, string> > lst = new List <KeyValuePair <string, string> >();
                    foreach (var item in Btns)
                    {
                        lst.Add(new KeyValuePair <string, string>(item, item));
                    }
                    ucTime.Source = lst;

                    _frmAnchor       = new Forms.FrmAnchor(this, ucTime);
                    _frmAnchor.Load += (a, b) => { (a as Form).Size = size; };

                    _frmAnchor.Show(this.FindForm());
                }
            }
            else
            {
                _frmAnchor.Close();
            }
        }
Esempio n. 6
0
        /// <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 == Scada.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 Scada.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);
            }
        }