예제 #1
0
        void TextBoxShow_MouseUp(object sender, MouseEventArgs e)
        {
            if (this.SelectionLength == 0 && m_blIsShow)
            {
                if (!this.Enabled)
                {
                    return;
                }

                SetDialogPosition();

                string temp = this.Text;
                show_list = new FrmShowList(strSql + " " + strEndSql, strPyColunm, strWbColunm, strCodeColunm, "", _sZstring, pt);
                show_list.IsMultiSelect = _IsMultiSelect;
                DialogResult result = show_list.ShowDialog();

                if (result == DialogResult.OK)
                {
                    if (!_IsMultiSelect)
                    {
                        _dataResult = show_list.DrShowlist;
                        this.Text   = _dataResult[strShowMessage].ToString();
                    }
                    else
                    {
                        _dataTableResult = show_list.DrRowList;

                        if (_dataTableResult.Rows.Count == 1)
                        {
                            _dataResult = _dataTableResult.Rows[0];
                        }

                        string showText = "";
                        foreach (DataRow dr in _dataTableResult.Rows)
                        {
                            showText += dr[strShowMessage].ToString() + "\r\n";
                        }
                        this.Text = showText.Trim();
                    }

                    this.SelectionStart = this.Text.Length;

                    if (OnCompleteSearch != null)
                    {
                        OnCompleteSearch();
                    }
                }
                else if (result == DialogResult.No)
                {
                    this.Text        = "";
                    this.Tag         = null;
                    _dataResult      = null;
                    _dataTableResult = null;
                }
                else
                {
                    this.Text = temp;
                }
            }
        }
예제 #2
0
        void TextBoxShow_KeyDown(object sender, KeyEventArgs e)
        {
            if (Convert.ToInt32(e.KeyData) < 100000 && m_blIsShow)
            {
                if (!this.Enabled || e.KeyData == Keys.Escape || e.KeyData == Keys.Enter || Convert.ToInt32(e.KeyData) > 100000 ||
                    e.KeyData == (Keys.LButton | Keys.ShiftKey))
                {
                    show_list.Close();
                    return;
                }

                SetDialogPosition();

                if (e.KeyData == Keys.Escape)
                {
                    return;
                }
                if (e.KeyData == Keys.Enter)
                {
                    return;
                }

                this.SelectAll();

                string temp = this.Text;
                show_list = new FrmShowList(strSql + " " + strEndSql, strPyColunm, strWbColunm, strCodeColunm, "", _sZstring, pt);
                show_list.IsMultiSelect = _IsMultiSelect;
                DialogResult result = show_list.ShowDialog();

                if (result == DialogResult.OK)
                {
                    if (!_IsMultiSelect)
                    {
                        _dataResult = show_list.DrShowlist;
                        this.Text   = _dataResult[strShowMessage].ToString();
                    }
                    else
                    {
                        _dataTableResult = show_list.DrRowList;

                        if (_dataTableResult.Rows.Count == 1)
                        {
                            _dataResult = _dataTableResult.Rows[0];
                        }

                        string showText = "";
                        foreach (DataRow dr in _dataTableResult.Rows)
                        {
                            showText += dr[strShowMessage].ToString() + "\r\n";
                        }
                        this.Text = showText.Trim();
                    }

                    if (OnCompleteSearch != null)
                    {
                        OnCompleteSearch();
                    }
                }
                else if (result == DialogResult.No)
                {
                    this.Text        = "";
                    this.Tag         = null;
                    _dataResult      = null;
                    _dataTableResult = null;
                }
                else
                {
                    this.Text = temp;
                }
            }
        }