This topic has not yet been rated - Rate this topic

ToolStripComboBox Class

Represents a ToolStripComboBox that is properly rendered in a ToolStrip.

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Windows.Forms.ToolStripItem
        System.Windows.Forms.ToolStripControlHost
          System.Windows.Forms.ToolStripComboBox

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
[ToolStripItemDesignerAvailabilityAttribute(ToolStripItemDesignerAvailability.None|ToolStripItemDesignerAvailability.ToolStrip|ToolStripItemDesignerAvailability.MenuStrip|ToolStripItemDesignerAvailability.ContextMenuStrip)]
public class ToolStripComboBox : ToolStripControlHost

The ToolStripComboBox type exposes the following members.

  Name Description
Public method ToolStripComboBox() Initializes a new instance of the ToolStripComboBox class.
Public method ToolStripComboBox(Control) Initializes a new instance of the ToolStripComboBox class derived from a base control.
Public method ToolStripComboBox(String) Initializes a new instance of the ToolStripComboBox class with the specified name.
Top
  Name Description
Public property AccessibilityObject Gets the AccessibleObject assigned to the control. (Inherited from ToolStripItem.)
Public property AccessibleDefaultActionDescription Gets or sets the default action description of the control for use by accessibility client applications. (Inherited from ToolStripItem.)
Public property AccessibleDescription Gets or sets the description that will be reported to accessibility client applications. (Inherited from ToolStripItem.)
Public property AccessibleName Gets or sets the name of the control for use by accessibility client applications. (Inherited from ToolStripItem.)
Public property AccessibleRole Gets or sets the accessible role of the control, which specifies the type of user interface element of the control. (Inherited from ToolStripItem.)
Public property Alignment Gets or sets a value indicating whether the item aligns towards the beginning or end of the ToolStrip. (Inherited from ToolStripItem.)
Public property AllowDrop Gets or sets a value indicating whether drag-and-drop and item reordering are handled through events that you implement. (Inherited from ToolStripItem.)
Public property Anchor Gets or sets the edges of the container to which a ToolStripItem is bound and determines how a ToolStripItem is resized with its parent. (Inherited from ToolStripItem.)
Public property AutoCompleteCustomSource Gets or sets the custom string collection to use when the AutoCompleteSource property is set to CustomSource.
Public property AutoCompleteMode Gets or sets a value that indicates the text completion behavior of the ToolStripComboBox.
Public property AutoCompleteSource Gets or sets the source of complete strings used for automatic completion.
Public property AutoSize Gets or sets a value indicating whether the item is automatically sized. (Inherited from ToolStripItem.)
Public property AutoToolTip Gets or sets a value indicating whether to use the Text property or the ToolTipText property for the ToolStripItem ToolTip. (Inherited from ToolStripItem.)
Public property Available Gets or sets a value indicating whether the ToolStripItem should be placed on a ToolStrip. (Inherited from ToolStripItem.)
Public property BackColor Gets or sets the background color for the item. (Inherited from ToolStripControlHost.)
Public property BackgroundImage Infrastructure. This property is not relevant to this class. (Overrides ToolStripControlHost.BackgroundImage.)
Public property BackgroundImageLayout Infrastructure. This property is not relevant to this class. (Overrides ToolStripControlHost.BackgroundImageLayout.)
Public property Bounds Gets the size and location of the item. (Inherited from ToolStripItem.)
Protected property CanRaiseEvents Gets a value indicating whether the component can raise an event. (Inherited from Component.)
Public property CanSelect Gets a value indicating whether the control can be selected. (Inherited from ToolStripControlHost.)
Public property CausesValidation Gets or sets a value indicating whether the hosted control causes and raises validation events on other controls when the hosted control receives focus. (Inherited from ToolStripControlHost.)
Public property ComboBox Gets a ComboBox in which the user can enter text, along with a list from which the user can select.
Public property Container Gets the IContainer that contains the Component. (Inherited from Component.)
Public property ContentRectangle Gets the area where content, such as text and icons, can be placed within a ToolStripItem without overwriting background borders. (Inherited from ToolStripItem.)
Public property Control Gets the Control that this ToolStripControlHost is hosting. (Inherited from ToolStripControlHost.)
Public property ControlAlign Gets or sets the alignment of the control on the form. (Inherited from ToolStripControlHost.)
Protected property DefaultAutoToolTip Gets a value indicating whether to display the ToolTip that is defined as the default. (Inherited from ToolStripItem.)
Protected property DefaultDisplayStyle Gets a value indicating what is displayed on the ToolStripItem. (Inherited from ToolStripItem.)
Protected property DefaultMargin Gets the default spacing, in pixels, between the ToolStripComboBox and an adjacent item. (Overrides ToolStripItem.DefaultMargin.)
Protected property DefaultPadding Gets the internal spacing characteristics of the item. (Inherited from ToolStripItem.)
Protected property DefaultSize Gets the default size of the ToolStripComboBox. (Overrides ToolStripControlHost.DefaultSize.)
Protected property DesignMode Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Protected property DismissWhenClicked Gets a value indicating whether items on a ToolStripDropDown are hidden after they are clicked. (Inherited from ToolStripItem.)
Public property DisplayStyle Infrastructure. This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property Dock Gets or sets which ToolStripItem borders are docked to its parent control and determines how a ToolStripItem is resized with its parent. (Inherited from ToolStripItem.)
Public property DoubleClickEnabled Infrastructure. This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property DropDownHeight Gets or sets the height, in pixels, of the drop-down portion box of a ToolStripComboBox.
Public property DropDownStyle Gets or sets a value specifying the style of the ToolStripComboBox.
Public property DropDownWidth Gets or sets the width, in pixels, of the drop-down portion of a ToolStripComboBox.
Public property DroppedDown Gets or sets a value indicating whether the ToolStripComboBox currently displays its drop-down portion.
Public property Enabled Gets or sets a value indicating whether the parent control of the ToolStripItem is enabled. (Inherited from ToolStripControlHost.)
Protected property Events Gets the list of event handlers that are attached to this Component. (Inherited from Component.)
Public property FlatStyle Gets or sets the appearance of the ToolStripComboBox.
Public property Focused Gets a value indicating whether the control has input focus. (Inherited from ToolStripControlHost.)
Public property Font Gets or sets the font to be used on the hosted control. (Inherited from ToolStripControlHost.)
Public property ForeColor Gets or sets the foreground color of the hosted control. (Inherited from ToolStripControlHost.)
Public property Height Gets or sets the height, in pixels, of a ToolStripItem. (Inherited from ToolStripItem.)
Public property Image Infrastructure. This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property ImageAlign Infrastructure. This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property ImageIndex Gets or sets the index value of the image that is displayed on the item. (Inherited from ToolStripItem.)
Public property ImageKey Gets or sets the key accessor for the image in the ImageList that is displayed on a ToolStripItem. (Inherited from ToolStripItem.)
Public property ImageScaling Infrastructure. This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property ImageTransparentColor This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property IntegralHeight Gets or sets a value indicating whether the ToolStripComboBox should resize to avoid showing partial items.
Public property IsDisposed Gets a value indicating whether the object has been disposed of. (Inherited from ToolStripItem.)
Public property IsOnDropDown Gets a value indicating whether the container of the current Control is a ToolStripDropDown. (Inherited from ToolStripItem.)
Public property IsOnOverflow Gets a value indicating whether the Placement property is set to Overflow. (Inherited from ToolStripItem.)
Public property Items Gets a collection of the items contained in this ToolStripComboBox.
Public property Margin Gets or sets the space between the item and adjacent items. (Inherited from ToolStripItem.)
Public property MaxDropDownItems Gets or sets the maximum number of items to be shown in the drop-down portion of the ToolStripComboBox.
Public property MaxLength Gets or sets the maximum number of characters allowed in the editable portion of a combo box.
Public property MergeAction Gets or sets how child menus are merged with parent menus. (Inherited from ToolStripItem.)
Public property MergeIndex Gets or sets the position of a merged item within the current ToolStrip. (Inherited from ToolStripItem.)
Public property Name Gets or sets the name of the item. (Inherited from ToolStripItem.)
Public property Overflow Gets or sets whether the item is attached to the ToolStrip or ToolStripOverflowButton or can float between the two. (Inherited from ToolStripItem.)
Public property Owner Gets or sets the owner of this item. (Inherited from ToolStripItem.)
Public property OwnerItem Gets the parent ToolStripItem of this ToolStripItem. (Inherited from ToolStripItem.)
Public property Padding Gets or sets the internal spacing, in pixels, between the item's contents and its edges. (Inherited from ToolStripItem.)
Protected property Parent Gets or sets the parent container of the ToolStripItem. (Inherited from ToolStripItem.)
Public property Placement Gets the current layout of the item. (Inherited from ToolStripItem.)
Public property Pressed Gets a value indicating whether the state of the item is pressed. (Inherited from ToolStripItem.)
Public property RightToLeft Gets or sets a value indicating whether items are to be placed from right to left and text is to be written from right to left. (Inherited from ToolStripControlHost.)
Public property RightToLeftAutoMirrorImage Infrastructure. This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property Selected Gets a value indicating whether the item is selected. (Inherited from ToolStripControlHost.)
Public property SelectedIndex Gets or sets the index specifying the currently selected item.
Public property SelectedItem Gets or sets currently selected item in the ToolStripComboBox.
Public property SelectedText Gets or sets the text that is selected in the editable portion of a ToolStripComboBox.
Public property SelectionLength Gets or sets the number of characters selected in the editable portion of the ToolStripComboBox.
Public property SelectionStart Gets or sets the starting index of text selected in the ToolStripComboBox.
Protected property ShowKeyboardCues Gets a value indicating whether to show or hide shortcut keys. (Inherited from ToolStripItem.)
Public property Site Gets or sets the site of the hosted control. (Inherited from ToolStripControlHost.)
Public property Size Gets or sets the size of the ToolStripItem. (Inherited from ToolStripControlHost.)
Public property Sorted Gets or sets a value indicating whether the items in the ToolStripComboBox are sorted.
Public property Tag Gets or sets the object that contains data about the item. (Inherited from ToolStripItem.)
Public property Text Gets or sets the text to be displayed on the hosted control. (Inherited from ToolStripControlHost.)
Public property TextAlign Infrastructure. This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property TextDirection Infrastructure. This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property TextImageRelation Infrastructure. This property is not relevant to this class. (Inherited from ToolStripControlHost.)
Public property ToolTipText Gets or sets the text that appears as a ToolTip for a control. (Inherited from ToolStripItem.)
Public property Visible Gets or sets a value indicating whether the item is displayed. (Inherited from ToolStripItem.)
Public property Width Gets or sets the width in pixels of a ToolStripItem. (Inherited from ToolStripItem.)
Top
  Name Description
Public method BeginUpdate Maintains performance when items are added to the ToolStripComboBox one at a time.
Protected method CreateAccessibilityInstance Creates a new accessibility object for the ToolStripItem. (Inherited from ToolStripControlHost.)
Public method CreateObjRef Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public method Dispose() Releases all resources used by the Component. (Inherited from Component.)
Protected method Dispose(Boolean) Releases the unmanaged resources used by the ToolStripControlHost and optionally releases the managed resources. (Inherited from ToolStripControlHost.)
Public method DoDragDrop Begins a drag-and-drop operation. (Inherited from ToolStripItem.)
Public method EndUpdate Resumes painting the ToolStripComboBox control after painting is suspended by the BeginUpdate method.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.)
Public method FindString(String) Finds the first item in the ToolStripComboBox that starts with the specified string.
Public method FindString(String, Int32) Finds the first item after the given index which starts with the given string.
Public method FindStringExact(String) Finds the first item in the ToolStripComboBox that exactly matches the specified string.
Public method FindStringExact(String, Int32) Finds the first item after the specified index that exactly matches the specified string.
Public method Focus Gives the focus to a control. (Inherited from ToolStripControlHost.)
Public method GetCurrentParent Retrieves the ToolStrip that is the container of the current ToolStripItem. (Inherited from ToolStripItem.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetItemHeight Returns the height, in pixels, of an item in the ToolStripComboBox.
Public method GetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method GetPreferredSize Retrieves the size of a rectangular area into which a control can be fitted. (Overrides ToolStripControlHost.GetPreferredSize(Size).)
Protected method GetService Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method InitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method Invalidate() Invalidates the entire surface of the ToolStripItem and causes it to be redrawn. (Inherited from ToolStripItem.)
Public method Invalidate(Rectangle) Invalidates the specified region of the ToolStripItem by adding it to the update region of the ToolStripItem, which is the area that will be repainted at the next paint operation, and causes a paint message to be sent to the ToolStripItem. (Inherited from ToolStripItem.)
Protected method IsInputChar Determines whether a character is an input character that the item recognizes. (Inherited from ToolStripItem.)
Protected method IsInputKey Determines whether the specified key is a regular input key or a special key that requires preprocessing. (Inherited from ToolStripItem.)
Protected method MemberwiseClone() Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method MemberwiseClone(Boolean) Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Protected method OnAvailableChanged Raises the AvailableChanged event. (Inherited from ToolStripItem.)
Protected method OnBackColorChanged Raises the BackColorChanged event. (Inherited from ToolStripItem.)
Protected method OnBoundsChanged Occurs when the Bounds property changes. (Inherited from ToolStripControlHost.)
Protected method OnClick Raises the Click event. (Inherited from ToolStripItem.)
Protected method OnDisplayStyleChanged Raises the DisplayStyleChanged event. (Inherited from ToolStripItem.)
Protected method OnDoubleClick Raises the DoubleClick event. (Inherited from ToolStripItem.)
Protected method OnDragDrop Raises the DragDrop event. (Inherited from ToolStripItem.)
Protected method OnDragEnter Raises the DragEnter event. (Inherited from ToolStripItem.)
Protected method OnDragLeave Raises the DragLeave event. (Inherited from ToolStripItem.)
Protected method OnDragOver Raises the DragOver event. (Inherited from ToolStripItem.)
Protected method OnDropDown Raises the DropDown event.
Protected method OnDropDownClosed Raises the DropDownClosed event.
Protected method OnDropDownStyleChanged Raises the DropDownStyleChanged event.
Protected method OnEnabledChanged Raises the EnabledChanged event. (Inherited from ToolStripItem.)
Protected method OnEnter Raises the Enter event. (Inherited from ToolStripControlHost.)
Protected method OnFontChanged Raises the FontChanged event. (Inherited from ToolStripItem.)
Protected method OnForeColorChanged Raises the ForeColorChanged event. (Inherited from ToolStripItem.)
Protected method OnGiveFeedback Raises the GiveFeedback event. (Inherited from ToolStripItem.)
Protected method OnGotFocus Raises the GotFocus event. (Inherited from ToolStripControlHost.)
Protected method OnHostedControlResize Synchronizes the resizing of the control host with the resizing of the hosted control. (Inherited from ToolStripControlHost.)
Protected method OnKeyDown Raises the KeyDown event. (Inherited from ToolStripControlHost.)
Protected method OnKeyPress Raises the KeyPress event. (Inherited from ToolStripControlHost.)
Protected method OnKeyUp Raises the KeyUp event. (Inherited from ToolStripControlHost.)
Protected method OnLayout Raises the Layout event. (Inherited from ToolStripControlHost.)
Protected method OnLeave Raises the Leave event. (Inherited from ToolStripControlHost.)
Protected method OnLocationChanged Raises the LocationChanged event. (Inherited from ToolStripItem.)
Protected method OnLostFocus Raises the LostFocus event. (Inherited from ToolStripControlHost.)
Protected method OnMouseDown Raises the MouseDown event. (Inherited from ToolStripItem.)
Protected method OnMouseEnter Raises the MouseEnter event. (Inherited from ToolStripItem.)
Protected method OnMouseHover Raises the MouseHover event. (Inherited from ToolStripItem.)
Protected method OnMouseLeave Raises the MouseLeave event. (Inherited from ToolStripItem.)
Protected method OnMouseMove Raises the MouseMove event. (Inherited from ToolStripItem.)
Protected method OnMouseUp Raises the MouseUp event. (Inherited from ToolStripItem.)
Protected method OnOwnerChanged Raises the OwnerChanged event. (Inherited from ToolStripItem.)
Protected method OnOwnerFontChanged Raises the FontChanged event when the Font property has changed on the parent of the ToolStripItem. (Inherited from ToolStripItem.)
Protected method OnPaint Raises the Paint event. (Inherited from ToolStripControlHost.)
Protected method OnParentBackColorChanged Raises the BackColorChanged event. (Inherited from ToolStripItem.)
Protected method OnParentChanged Raises the ParentChanged event. (Inherited from ToolStripControlHost.)
Protected method OnParentEnabledChanged Raises the EnabledChanged event when the Enabled property value of the item's container changes. (Inherited from ToolStripItem.)
Protected method OnParentForeColorChanged Raises the ForeColorChanged event. (Inherited from ToolStripItem.)
Protected method OnParentRightToLeftChanged Raises the RightToLeftChanged event. (Inherited from ToolStripItem.)
Protected method OnQueryContinueDrag Raises the QueryContinueDrag event. (Inherited from ToolStripItem.)
Protected method OnRightToLeftChanged Raises the RightToLeftChanged event. (Inherited from ToolStripItem.)
Protected method OnSelectedIndexChanged Raises the SelectedIndexChanged event.
Protected method OnSelectionChangeCommitted Raises the SelectionChangeCommitted event.
Protected method OnSubscribeControlEvents Subscribes events from the specified control. (Overrides ToolStripControlHost.OnSubscribeControlEvents(Control).)
Protected method OnTextChanged Raises the TextChanged event. (Inherited from ToolStripItem.)
Protected method OnTextUpdate Raises the TextUpdate event.
Protected method OnUnsubscribeControlEvents Unsubscribes events from the specified control. (Overrides ToolStripControlHost.OnUnsubscribeControlEvents(Control).)
Protected method OnValidated Raises the Validated event. (Inherited from ToolStripControlHost.)
Protected method OnValidating Raises the Validating event. (Inherited from ToolStripControlHost.)
Protected method OnVisibleChanged Raises the VisibleChanged event. (Inherited from ToolStripItem.)
Public method PerformClick Activates the ToolStripItem when it is clicked with the mouse. (Inherited from ToolStripItem.)
Protected method ProcessCmdKey Processes a command key. (Inherited from ToolStripControlHost.)
Protected method ProcessDialogKey Processes a dialog key. (Inherited from ToolStripControlHost.)
Protected method ProcessMnemonic Processes a mnemonic character. (Inherited from ToolStripControlHost.)
Public method ResetBackColor Infrastructure. This method is not relevant to this class. (Inherited from ToolStripControlHost.)
Public method ResetDisplayStyle Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.)
Public method ResetFont Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.)
Public method ResetForeColor Infrastructure. This method is not relevant to this class. (Inherited from ToolStripControlHost.)
Public method ResetImage Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.)
Public method ResetMargin Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.)
Public method ResetPadding Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.)
Public method ResetRightToLeft Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.)
Public method ResetTextDirection Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.)
Public method Select() Selects the item. (Inherited from ToolStripItem.)
Public method Select(Int32, Int32) Selects a range of text in the editable portion of the ToolStripComboBox.
Public method SelectAll Selects all the text in the editable portion of the ToolStripComboBox.
Protected method SetBounds Sets the size and location of the item. (Inherited from ToolStripItem.)
Protected method SetVisibleCore Sets the ToolStripItem to the specified visible state. (Inherited from ToolStripControlHost.)
Public method ToString Returns a string representation of the ToolStripComboBox. (Overrides ToolStripItem.ToString().)
Top
  Name Description
Public event AvailableChanged Occurs when the value of the Available property changes. (Inherited from ToolStripItem.)
Public event BackColorChanged Occurs when the value of the BackColor property changes. (Inherited from ToolStripItem.)
Public event Click Occurs when the ToolStripItem is clicked. (Inherited from ToolStripItem.)
Public event DisplayStyleChanged Infrastructure. This event is not relevant to this class. (Inherited from ToolStripControlHost.)
Public event Disposed Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Public event DoubleClick Infrastructure. This event is not relevant to this class.
Public event DragDrop Occurs when the user drags an item and the user releases the mouse button, indicating that the item should be dropped into this item. (Inherited from ToolStripItem.)
Public event DragEnter Occurs when the user drags an item into the client area of this item. (Inherited from ToolStripItem.)
Public event DragLeave Occurs when the user drags an item and the mouse pointer is no longer over the client area of this item. (Inherited from ToolStripItem.)
Public event DragOver Occurs when the user drags an item over the client area of this item. (Inherited from ToolStripItem.)
Public event DropDown Occurs when the drop-down portion of a ToolStripComboBox is shown.
Public event DropDownClosed Occurs when the drop-down portion of the ToolStripComboBox has closed.
Public event DropDownStyleChanged Occurs when the DropDownStyle property has changed.
Public event EnabledChanged Occurs when the Enabled property value has changed. (Inherited from ToolStripItem.)
Public event Enter Occurs when the hosted control is entered. (Inherited from ToolStripControlHost.)
Public event ForeColorChanged Occurs when the ForeColor property value changes. (Inherited from ToolStripItem.)
Public event GiveFeedback Occurs during a drag operation. (Inherited from ToolStripItem.)
Public event GotFocus Occurs when the hosted control receives focus. (Inherited from ToolStripControlHost.)
Public event KeyDown Occurs when a key is pressed and held down while the hosted control has focus. (Inherited from ToolStripControlHost.)
Public event KeyPress Occurs when a key is pressed while the hosted control has focus. (Inherited from ToolStripControlHost.)
Public event KeyUp Occurs when a key is released while the hosted control has focus. (Inherited from ToolStripControlHost.)
Public event Leave Occurs when the input focus leaves the hosted control. (Inherited from ToolStripControlHost.)
Public event LocationChanged Occurs when the location of a ToolStripItem is updated. (Inherited from ToolStripItem.)
Public event LostFocus Occurs when the hosted control loses focus. (Inherited from ToolStripControlHost.)
Public event MouseDown Occurs when the mouse pointer is over the item and a mouse button is pressed. (Inherited from ToolStripItem.)
Public event MouseEnter Occurs when the mouse pointer enters the item. (Inherited from ToolStripItem.)
Public event MouseHover Occurs when the mouse pointer hovers over the item. (Inherited from ToolStripItem.)
Public event MouseLeave Occurs when the mouse pointer leaves the item. (Inherited from ToolStripItem.)
Public event MouseMove Occurs when the mouse pointer is moved over the item. (Inherited from ToolStripItem.)
Public event MouseUp Occurs when the mouse pointer is over the item and a mouse button is released. (Inherited from ToolStripItem.)
Public event OwnerChanged Occurs when the Owner property changes. (Inherited from ToolStripItem.)
Public event Paint Occurs when the item is redrawn. (Inherited from ToolStripItem.)
Public event QueryAccessibilityHelp Occurs when an accessibility client application invokes help for the ToolStripItem. (Inherited from ToolStripItem.)
Public event QueryContinueDrag Occurs during a drag-and-drop operation and allows the drag source to determine whether the drag-and-drop operation should be canceled. (Inherited from ToolStripItem.)
Public event RightToLeftChanged Occurs when the RightToLeft property value changes. (Inherited from ToolStripItem.)
Public event SelectedIndexChanged Occurs when the value of the SelectedIndex property has changed.
Public event TextChanged Occurs when the value of the Text property changes. (Inherited from ToolStripItem.)
Public event TextUpdate Occurs when the ToolStripComboBox text has changed.
Public event Validated Occurs after the hosted control has been successfully validated. (Inherited from ToolStripControlHost.)
Public event Validating Occurs while the hosted control is validating. (Inherited from ToolStripControlHost.)
Public event VisibleChanged Occurs when the value of the Visible property changes. (Inherited from ToolStripItem.)
Top
  Name Description
Explicit interface implemetation Private method IDropTarget.OnDragDrop Raises the DragDrop event. (Inherited from ToolStripItem.)
Explicit interface implemetation Private method IDropTarget.OnDragEnter Raises the DragEnter event. (Inherited from ToolStripItem.)
Explicit interface implemetation Private method IDropTarget.OnDragLeave Raises the DragLeave event. (Inherited from ToolStripItem.)
Explicit interface implemetation Private method IDropTarget.OnDragOver Raises the DragOver event. (Inherited from ToolStripItem.)
Top

ToolStripComboBox is the ComboBox optimized for hosting in a ToolStrip. A subset of the hosted control's properties and events are exposed at the ToolStripComboBox level, but the underlying ComboBox control is fully accessible through the ComboBox property.

A ToolStripComboBox displays an editing field combined with a ListBox, allowing the user to select from the list or to enter new text. By default, a ToolStripComboBox displays an edit field with a hidden drop-down list. The DropDownStyle property determines the style of combo box to display. You can enter a value that allows for a simple drop-down, where the list always displays, a drop-down list box, where the text portion is not editable and you must select an arrow to view the drop-down list box, or the default drop-down list box, where the text portion is editable and the user must press the arrow key to view the list. To always display a list that the user cannot edit, use a ListBox control.

To add objects to the list at run time, assign an array of object references with the AddRange method. The list then displays the default string value for each object. You can add individual objects with the Add method.

In addition to display and selection functionality, the ToolStripComboBox also provides features that enable you to efficiently add items to the ToolStripComboBox and to find text within the items of the list. The BeginUpdate and EndUpdate methods enable you to add a large number of items to the ToolStripComboBox without the control being repainted each time an item is added to the list. The FindString and FindStringExact methods enable you to search for an item in the list that contains a specific search string.

Use the SelectedIndex property to get or set the current item in the drop-down list, and use the SelectedItem property to get or set a reference to the current item in the drop-down list.

The following code example demonstrates a ToolStripComboBox with various property settings, including automatic completion.


using System;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public class Form1 : Form
    {
        private ToolStrip toolStrip1;
        private ToolStripComboBox toolStripComboBox1;

        public Form1()
        {
            InitializeComponent();
        }
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new Form1());
        }

        private void InitializeComponent()
        {
            toolStrip1 = new System.Windows.Forms.ToolStrip();
            toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox();
            toolStrip1.SuspendLayout();
            SuspendLayout();
            // 
            // toolStrip1
            // 
            toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            toolStripComboBox1});
            toolStrip1.Location = new System.Drawing.Point(0, 0);
            toolStrip1.Name = "toolStrip1";
            toolStrip1.Size = new System.Drawing.Size(292, 25);
            toolStrip1.TabIndex = 0;
            toolStrip1.Text = "toolStrip1";
            // The following code example demonstrates the syntax for setting
            // various ToolStripComboBox properties.
            // 
            toolStripComboBox1.AutoCompleteCustomSource.AddRange(new string[] {
            "aaa",
            "bbb",
            "ccc"});
            toolStripComboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
            toolStripComboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
            toolStripComboBox1.DropDownHeight = 110;
            toolStripComboBox1.DropDownWidth = 122;
            toolStripComboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Standard;
            toolStripComboBox1.IntegralHeight = false;
            toolStripComboBox1.Items.AddRange(new object[] {
            "xxx",
            "yyy",
            "zzz"});
            toolStripComboBox1.MaxDropDownItems = 9;
            toolStripComboBox1.MergeAction = System.Windows.Forms.MergeAction.Insert;
            toolStripComboBox1.Name = "toolStripComboBox1";
            toolStripComboBox1.Size = new System.Drawing.Size(121, 25);
            toolStripComboBox1.Sorted = true;
            // 
            // Form1
            // 
            ClientSize = new System.Drawing.Size(292, 273);
            Controls.Add(toolStrip1);
            Name = "Form1";
            toolStrip1.ResumeLayout(false);
            toolStrip1.PerformLayout();
            ResumeLayout(false);
            PerformLayout();

        }
    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ