src/Misc/EFTools/DesignXmlCore/VirtualTreeGrid/DropDownControl.cs
/// <summary>
///     Create the edit/drop-down controls when our handle is created.
/// </summary>
Create the edit/drop-down controls when our handle is created.
Create the edit / drop - down controls when our handle is created .
protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);
            switch (_editControlStyle)
            {
                case TypeEditorHostEditControlStyle.Editable:
                    InitializeEdit();
                    break;
                case TypeEditorHostEditControlStyle.ReadOnlyEdit:
                    InitializeEdit();
                    _edit.ReadOnly = true;
                    break;
                case TypeEditorHostEditControlStyle.InstructionLabel:
                    InitializeInstructionLabel();
                    UpdateInstructionLabelText();
                    break;
            }
            if (EditStyle != UITypeEditorEditStyle.None)
            {
                _button = new DropDownButton();
                _button.Dock = DockStyle.Right;
                _button.FlatStyle = FlatStyle.Flat;
                _button.FlatAppearance.BorderSize = 0;
                _button.FlatAppearance.MouseDownBackColor
                    = VSColorTheme.GetThemedColor(EnvironmentColors.ComboBoxButtonMouseDownBackgroundColorKey);
                _button.FlatAppearance.MouseOverBackColor
                    = VSColorTheme.GetThemedColor(EnvironmentColors.ComboBoxButtonMouseOverBackgroundColorKey);
                _button.TabStop = _edit == null;
                if (_editStyle == UITypeEditorEditStyle.DropDown)
                {
                    _button.Image = CreateArrowBitmap();
                    _button.AccessibleName = VirtualTreeStrings.GetString(VirtualTreeStrings.DropDownButtonAccessibleName);
                }
                else if (_editStyle == UITypeEditorEditStyle.Modal)
                {
                    _button.Image = CreateDotDotDotBitmap();
                    _button.AccessibleName = VirtualTreeStrings.GetString(VirtualTreeStrings.BrowseButtonAccessibleName);
                }
                _button.Size = new Size(SystemInformation.VerticalScrollBarArrowHeight, Font.Height);
                _button.BackColor = VSColorTheme.GetThemedColor(EnvironmentColors.ComboBoxBackgroundColorKey);
                Controls.Add(_button);
                _button.Click += OnDropDownButtonClick;
                _button.LostFocus += OnContainedControlLostFocus;
            }
            if (_dropDownHolder == null
                && EditStyle == UITypeEditorEditStyle.DropDown)
            {
                _dropDownHolder = new DropDownHolder(this);
                _dropDownHolder.Font = Font;
            }
        }
protected override void OnHandleCreated ( EventArgs e ) { base . OnHandleCreated ( e ) ; switch ( _editControlStyle ) { case TypeEditorHostEditControlStyle . Editable : InitializeEdit ( ) ; break ; case TypeEditorHostEditControlStyle . ReadOnlyEdit : InitializeEdit ( ) ; _edit . ReadOnly = true ; break ; case TypeEditorHostEditControlStyle . InstructionLabel : InitializeInstructionLabel ( ) ; UpdateInstructionLabelText ( ) ; break ; } if ( EditStyle != UITypeEditorEditStyle . None ) { _button = new DropDownButton ( ) ; _button . Dock = DockStyle . Right ; _button . FlatStyle = FlatStyle . Flat ; _button . FlatAppearance . BorderSize = 0 ; _button . FlatAppearance . MouseDownBackColor = VSColorTheme . GetThemedColor ( EnvironmentColors . ComboBoxButtonMouseDownBackgroundColorKey ) ; _button . FlatAppearance . MouseOverBackColor = VSColorTheme . GetThemedColor ( EnvironmentColors . ComboBoxButtonMouseOverBackgroundColorKey ) ; _button . TabStop = _edit == null ; if ( _editStyle == UITypeEditorEditStyle . DropDown ) { _button . Image = CreateArrowBitmap ( ) ; _button . AccessibleName = VirtualTreeStrings . GetString ( VirtualTreeStrings . DropDownButtonAccessibleName ) ; } else if ( _editStyle == UITypeEditorEditStyle . Modal ) { _button . Image = CreateDotDotDotBitmap ( ) ; _button . AccessibleName = VirtualTreeStrings . GetString ( VirtualTreeStrings . BrowseButtonAccessibleName ) ; } _button . Size = new Size ( SystemInformation . VerticalScrollBarArrowHeight , Font . Height ) ; _button . BackColor = VSColorTheme . GetThemedColor ( EnvironmentColors . ComboBoxBackgroundColorKey ) ; Controls . Add ( _button ) ; _button . Click += OnDropDownButtonClick ; _button . LostFocus += OnContainedControlLostFocus ; } if ( _dropDownHolder == null && EditStyle == UITypeEditorEditStyle . DropDown ) { _dropDownHolder = new DropDownHolder ( this ) ; _dropDownHolder . Font = Font ; } }
Create the edit/drop-down controls when our handle is created.
Create the edit / drop - down controls when our handle is created .
// create the edit box.  done before creating the button because // DockStyle.Right controls should be added first. // create the drop-down button // only allow focus to go to the drop-down button if we don't have an edit control. // if we have an edit control, we want this to act like a combo box, where only the edit control // is focusable.  If there's no edit control, though, we need to make sure the button can be  // focused, to prevent WinForms from forwarding focus somewhere else. // set button name for accessibility purposes. // set button name for accessibility purposes. // Bug 17449 (Currituck). Use the system prescribed one, property grid uses this approach in  // ndp\fx\src\winforms\managed\system\winforms\propertygridinternal\propertygridview.cs  // Create the drop down control container.  Check for null here because this // may have already been created via a call to SetComponent.
e
EventArgs