This control represents an edit box with a drop-down lista standard Win32 combobox. It extends the base ListControl that supports a variety of list-like controls. In addition to the standard control facilities, you can set the DropDownStyle property, which determines whether the edit box allows you to type into it and whether the list view is always visible, and set the DropDownWidth property of the drop-down list. You can set the IntegralHeight property, which can automatically adjust the height of the control to ensure that only whole items are displayed. The MaxDropDownItems property sets the maximum number of items that will be displayed in the drop-down list (without scrolling), and the MaxLength property sets the number of characters allowed in the edit field. The selected item can be retrieved through the SelectedItem and SelectedIndex properties, which should not be confused with the SelectedText property, which gets the selected text in the edit field. You can add and remove objects from the Items collection to alter the contents of the listbox, and the very useful members FindString() and FindStringExact() can help you locate a particular item in the list. Finally, you can select the text in the edit field using Select() or SelectAll() . Unfortunately, the implementation of ComboBox in Version 1.0 of the framework is something of a minor fiasco. The edit control doesn't support the standard pop-up menus , and the selection and edit behavior is idiosyncratic to say the least ( especially when hosted on a TabPage ). Microsoft has indicated that this will almost certainly be improved in the next release. public class ComboBox : ListControl { // Public Constructors public ComboBox (); // Public Instance Properties public override Color BackColor {set; get; } // overrides Control public override Image BackgroundImage {set; get; } // overrides Control public DrawMode DrawMode {set; get; } public ComboBoxStyle DropDownStyle {set; get; } public int DropDownWidth {set; get; } public bool DroppedDown {set; get; } public override bool Focused {get; } // overrides Control public override Color ForeColor {set; get; } // overrides Control public bool IntegralHeight {set; get; } public int ItemHeight {set; get; } public ObjectCollection Items {get; } public int MaxDropDownItems {set; get; } public int MaxLength {set; get; } public int PreferredHeight {get; } public override int SelectedIndex {set; get; } // overrides ListControl public object SelectedItem {set; get; } public string SelectedText {set; get; } public int SelectionLength {set; get; } public int SelectionStart {set; get; } public bool Sorted {set; get; } public override string Text {set; get; } // overrides Control // Protected Instance Properties protected override CreateParams CreateParams {get; } // overrides Control protected override Size DefaultSize {get; } // overrides Control // Public Instance Methods public void BeginUpdate (); public void EndUpdate (); public int FindString (string s ); public int FindString (string s , int startIndex ); public int FindStringExact (string s ); public int FindStringExact (string s , int startIndex ); public int GetItemHeight (int index ); public void Select (int start , int length ); public void SelectAll (); public override string ToString (); // overrides System.ComponentModel.Component // Protected Instance Methods protected virtual void AddItemsCore (object[ ] value ); protected override void Dispose (bool disposing ); // overrides Control protected override bool IsInputKey (Keys keyData ); // overrides ListControl protected override void OnBackColorChanged (EventArgs e ); // overrides Control protected override void OnDataSourceChanged (EventArgs e ); // overrides ListControl protected override void OnDisplayMemberChanged (EventArgs e ); // overrides ListControl protected virtual void OnDrawItem (DrawItemEventArgs e ); protected virtual void OnDropDown (EventArgs e ); protected virtual void OnDropDownStyleChanged (EventArgs e ); protected override void OnFontChanged (EventArgs e ); // overrides Control protected override void OnForeColorChanged (EventArgs e ); // overrides Control protected override void OnHandleCreated (EventArgs e ); // overrides Control protected override void OnHandleDestroyed (EventArgs e ); // overrides Control protected override void OnKeyPress (KeyPressEventArgs e ); // overrides Control protected virtual void OnMeasureItem (MeasureItemEventArgs e ); protected override void OnParentBackColorChanged (EventArgs e ); // overrides Control protected override void OnResize (EventArgs e ); // overrides Control protected override void OnSelectedIndexChanged (EventArgs e ); // overrides ListControl protected virtual void OnSelectedItemChanged (EventArgs e ); protected virtual void OnSelectionChangeCommitted (EventArgs e ); protected override void RefreshItem (int index ); // overrides ListControl protected override void SetBoundsCore (int x , int y , int width , int height , BoundsSpecified specified ); // overrides Control protected override void SetItemCore (int index , object value ); // overrides ListControl protected override void SetItemsCore (System.Collections.IList value ); // overrides ListControl protected override void WndProc (ref Message m ); // overrides Control // Events public event DrawItemEventHandler DrawItem ; public event EventHandler DropDown ; public event EventHandler DropDownStyleChanged ; public event MeasureItemEventHandler MeasureItem ; public event PaintEventHandler Paint ; // overrides Control public event EventHandler SelectedIndexChanged ; public event EventHandler SelectionChangeCommitted ; } HierarchySystem.Object System.MarshalByRefObject System.ComponentModel.Component(System.ComponentModel.IComponen, System.IDisposable) Control(IOleContro, IOleObject , IOleInPlaceObject , IOleInPlaceActiveObject , IOleWindow , IViewObject , IViewObject2 , IPersist , IPersistStreamInit , IPersistPropertyBag , IPersistStorage , IQuickActivate , System.ComponentModel.ISynchronizeInvoke , IWin32Window) ListControl ComboBox Passed ToChildAccessibleObject.ChildAccessibleObject() , ObjectCollection.ObjectCollection() |