public void AddControl(IComboBoxExtender child) { try { childControl = child; childControl.SetUserInterface( ); treeViewHost = new ToolStripControlHost(childControl as Control); treeViewHost.Visible = false; CloseComboBoxExtenderHandler closeCombo = new CloseComboBoxExtenderHandler(CloseComboBox); childControl.CloseComboBoxExtenderDelegate = closeCombo; dropDown = new ToolStripDropDown( ); dropDown.Items.Add(treeViewHost); dropDown.AutoClose = true; this.DropDownStyle = ComboBoxStyle.DropDownList; dropDown.Closed += new ToolStripDropDownClosedEventHandler(DropDownClosed); this.EnabledChanged += new EventHandler(ExtenderCombo_EnabledChanged); closeCombo( ); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void AddControl( IComboBoxExtender child ) { try { childControl = child; childControl.SetUserInterface ( ); treeViewHost = new ToolStripControlHost ( childControl as Control ); treeViewHost.Visible = false; CloseComboBoxExtenderHandler closeCombo = new CloseComboBoxExtenderHandler ( CloseComboBox ); childControl.CloseComboBoxExtenderDelegate = closeCombo; dropDown = new ToolStripDropDown ( ); dropDown.Items.Add ( treeViewHost ); dropDown.AutoClose = true; this.DropDownStyle = ComboBoxStyle.DropDownList; dropDown.Closed += new ToolStripDropDownClosedEventHandler ( DropDownClosed ); this.EnabledChanged += new EventHandler ( ExtenderCombo_EnabledChanged ); closeCombo ( ); } catch ( Exception ex ) { MessageBox.Show ( ex.Message ); } }