示例#1
0
        private void ShowDropDown()
        {
            if (m_bIsComboBox)
            {
                bool bCancel = false;

                if (DroppingDown != null)
                {
                    DroppingDown(ref bCancel);
                }

                if (!bCancel)
                {
                    int nCurrListHeight = m_RowWnd.Rows.TotalRowHeight
                                          + (m_RowWnd.ColumnHeader.Visible ? m_RowWnd.ColumnHeader.ColumnHeight : 0);

                    m_DropDownWnd.Size = new Size(
                        m_nDropDownWidth <0 ? this.Width : m_nDropDownWidth,
                                          nCurrListHeight> m_nDropDownMaxHeight ? m_nDropDownMaxHeight : nCurrListHeight);

                    m_DropDownWnd.Show(Parent.PointToScreen(new Point(this.Location.X, this.Location.Y + this.Height)));
                    m_RowWnd.Focus();

                    if (DroppedDown != null)
                    {
                        DroppedDown();
                    }
                }
            }
        }
示例#2
0
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            //if (m_bNumericOnly && !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar))
            //{
            //  e.Handled = true;
            //}
            //else
            {
                if (e.KeyChar == (char)Keys.Escape)
                {
                    PostEditBoxFinishEdit(false);
                    m_Parent.Focus();
                    e.Handled = true;
                }
                else
                {
                    if (this.Multiline && e.KeyChar == (char)13)
                    {
                        //Rectangle ParentRowBounds = m_Parent.RowBounds;
                        //if((this.Location.Y + this.Height + this.Font.Height) < (ParentRowBounds.Y + ParentRowBounds.Height))
                        //this.Height += this.Font.Height;
                    }
                    else
                    {
                        if (m_bCtrlDown && e.KeyChar == (char)10)
                        {
                            PostEditBoxFinishEdit(true);
                            m_Parent.Focus();
                            e.Handled = true;
                        }
                    }
                }
            }

            base.OnKeyPress(e);
        }