internal DropDownHolder(TypeEditorHost dropDownParent)
 {
     ShowInTaskbar = false;
     ControlBox = false;
     MinimizeBox = false;
     MaximizeBox = false;
     Text = String.Empty;
     FormBorderStyle = FormBorderStyle.None;
     StartPosition = FormStartPosition.Manual; // set this to avoid being moved when our handle is created.
     _mouseHooker = new MouseHooker(this, this);
     Visible = false;
     BackColor = VSColorTheme.GetThemedColor(EnvironmentColors.ComboBoxBackgroundColorKey);
     _dropDownParent = dropDownParent;
 }
        /// <summary>
        ///     Edit control displayed in the TypeEditorHost.  Just a TextBox with some addtional
        ///     key message processing for opening the drop down.
        /// </summary>
        public TypeEditorHostTextBox(TypeEditorHost dropDownParent)
        {
            _dropDownParent = dropDownParent;

            BackColor = VSColorTheme.GetThemedColor(EnvironmentColors.ComboBoxBackgroundColorKey);
            ForeColor = VSColorTheme.GetThemedColor(EnvironmentColors.ComboBoxTextColorKey);
        }
        /// <summary>
        ///     Factory method for creating the appropriate drop-down control based on the given property descriptor.
        ///     If the property descriptor supports a UITypeEditor, a TypeEditorHost will be created with that editor.
        ///     If not, and the TypeConverver attached to the PropertyDescriptor supports standard values, a
        ///     TypeEditorHostListBox will be created with this TypeConverter.
        /// </summary>
        /// <param name="propertyDescriptor">A property descriptor describing the property being set</param>
        /// <param name="instance">The object instance being edited</param>
        /// <param name="editControlStyle">The type of control to show in the edit area.</param>
        /// <returns>A TypeEditorHost instance if the given property descriptor supports it, null otherwise.</returns>
        public static TypeEditorHost Create(
            PropertyDescriptor propertyDescriptor, object instance, TypeEditorHostEditControlStyle editControlStyle)
        {
            TypeEditorHost dropDown = null;

            if (propertyDescriptor != null)
            {
                var uiTypeEditor = propertyDescriptor.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
                if (uiTypeEditor != null) // UITypeEditor case
                {
                    dropDown = new TypeEditorHost(uiTypeEditor, propertyDescriptor, instance, editControlStyle);
                }
                else
                {
                    var converter = propertyDescriptor.Converter;
                    if (converter != null
                        && converter.GetStandardValuesSupported(null)) // converter case
                    {
                        dropDown = new TypeEditorHostListBox(converter, propertyDescriptor, instance, editControlStyle);
                    }
                }
            }

            return dropDown;
        }