示例#1
0
        /// <summary>
        /// We make our DropDownForm host the choosen control and show it instead
        /// of the dropdown portion of the ComboBox.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Combo_DropDown(object sender, EventArgs e)
        {
            if (!_dropDownHelper.DropDownShowing)
            {
                DropDownForm dropDown = new DropDownForm(_dropDownControl);

                dropDown.FinishEditing += new DropDownValueChangedEventHandler(DropDown_FinishEditing);
                dropDown.ValueChanged  += new DropDownValueChangedEventHandler(DropDown_ValueChanged);

                combo.DroppedDown = false;
                _dropDownHelper.ShowDropDown(_owner, dropDown, GetDropDownPosition(dropDown));
            }
            else
            {
                _dropDownHelper.CloseDropDown();
                this.Focus();
            }
        }
示例#2
0
        protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
        {
            if (this.DropDownCancel != null)
            {
                this.DropDownCancel(this, e);
            }

            if (!e.Cancel)
            {
                _owner.CloseDropDown();
                _dropDown = null;                                       // Clear reference for GC
            }
        }