System.Windows.Forms.ListBox Members

The members of System.Windows.Forms.ListBox are listed below.

See Also: Inherited members from System.Windows.Forms.ListControl

Public Constructors

Initializes a new instance of the System.Windows.Forms.ListBox class.

Public Fields

const
DefaultItemHeightint (13).

Specifies the default item height for an owner-drawn System.Windows.Forms.ListBox.

const
NoMatchesint (-1).

Specifies that no matches are found during a search.

Public Properties

override
BackColorSystem.Drawing.Color.

Gets or sets the background color for the control.

override
BackgroundImageSystem.Drawing.Image.

This property is not relevant to this class.

override
BackgroundImageLayoutImageLayout.

Gets or sets the background image layout for a System.Windows.Forms.ListBox as defined in the System.Windows.Forms.ImageLayout enumeration.

BorderStyleBorderStyle.

Gets or sets the type of border that is drawn around the System.Windows.Forms.ListBox.

ColumnWidthint.

Gets or sets the width of columns in a multicolumn System.Windows.Forms.ListBox.

[read-only]
CustomTabOffsetsListBox.IntegerCollection.

Gets the width of the tabs between the items in the System.Windows.Forms.ListBox.

DrawModeDrawMode.

Gets or sets the drawing mode for the control.

override
FontSystem.Drawing.Font.

Gets or sets the font of the text displayed by the control.

override
ForeColorSystem.Drawing.Color.

Gets or sets the foreground color of the control.

HorizontalExtentint.

Gets or sets the width by which the horizontal scroll bar of a System.Windows.Forms.ListBox can scroll.

HorizontalScrollbarbool.

Gets or sets a value indicating whether a horizontal scroll bar is displayed in the control.

IntegralHeightbool.

Gets or sets a value indicating whether the control should resize to avoid showing partial items.

ItemHeightint.

Gets or sets the height of an item in the System.Windows.Forms.ListBox.

[read-only]
ItemsListBox.ObjectCollection.

Gets the items of the System.Windows.Forms.ListBox.

MultiColumnbool.

Gets or sets a value indicating whether the System.Windows.Forms.ListBox supports multiple columns.

PaddingPadding.

This property is not relevant to this class.

[read-only]
PreferredHeightint.

Gets the combined height of all items in the System.Windows.Forms.ListBox.

override
RightToLeftRightToLeft.

Gets or sets a value indicating whether text displayed by the control is displayed from right to left.

ScrollAlwaysVisiblebool.

Gets or sets a value indicating whether the vertical scroll bar is shown at all times.

override
SelectedIndexint.

Gets or sets the zero-based index of the currently selected item in a System.Windows.Forms.ListBox.

[read-only]
SelectedIndicesListBox.SelectedIndexCollection.

Gets a collection that contains the zero-based indexes of all currently selected items in the System.Windows.Forms.ListBox.

SelectedItemobject.

Gets or sets the currently selected item in the System.Windows.Forms.ListBox.

[read-only]
SelectedItemsListBox.SelectedObjectCollection.

Gets a collection containing the currently selected items in the System.Windows.Forms.ListBox.

SelectionModeSelectionMode.

Gets or sets the method in which items are selected in the System.Windows.Forms.ListBox.

Sortedbool.

Gets or sets a value indicating whether the items in the System.Windows.Forms.ListBox are sorted alphabetically.

override
Textstring.

Gets or searches for the text of the currently selected item in the System.Windows.Forms.ListBox.

TopIndexint.

Gets or sets the index of the first visible item in the System.Windows.Forms.ListBox.

UseCustomTabOffsetsbool.

Gets or sets a value indicating whether the System.Windows.Forms.ListBox recognizes and expands tab characters when it draws its strings by using the ListBox.CustomTabOffsets integer array.

UseTabStopsbool.

Gets or sets a value indicating whether the System.Windows.Forms.ListBox can recognize and expand tab characters when drawing its strings.

Protected Properties

[read-only]
override
AllowSelectionbool.

Gets a value indicating whether the System.Windows.Forms.ListBox currently enables selection of list items.

[read-only]
override
CreateParamsCreateParams.

Gets the required creation parameters when the control handle is created.

[read-only]
override
DefaultSizeSystem.Drawing.Size.

Gets the default size of the control.

Public Methods

BeginUpdate()

Maintains performance while items are added to the System.Windows.Forms.ListBox one at a time by preventing the control from drawing until the ListBox.EndUpdate method is called.

ClearSelected()

Unselects all items in the System.Windows.Forms.ListBox.

EndUpdate()

Resumes painting the System.Windows.Forms.ListBox control after painting is suspended by the ListBox.BeginUpdate method.

FindString(string) : int

Finds the first item in the System.Windows.Forms.ListBox that starts with the specified string.

FindString(string, int) : int

Finds the first item in the System.Windows.Forms.ListBox that starts with the specified string. The search starts at a specific starting index.

FindStringExact(string) : int

Finds the first item in the System.Windows.Forms.ListBox that exactly matches the specified string.

FindStringExact(string, int) : int

Finds the first item in the System.Windows.Forms.ListBox that exactly matches the specified string. The search starts at a specific starting index.

GetItemHeight(int) : int

Returns the height of an item in the System.Windows.Forms.ListBox.

GetItemRectangle(int) : System.Drawing.Rectangle

Returns the bounding rectangle for an item in the System.Windows.Forms.ListBox.

GetSelected(int) : bool

Returns a value indicating whether the specified item is selected.

IndexFromPoint(System.Drawing.Point) : int

Returns the zero-based index of the item at the specified coordinates.

IndexFromPoint(int, int) : int

Returns the zero-based index of the item at the specified coordinates.

override
Refresh()

Forces the control to invalidate its client area and immediately redraw itself and any child controls.

override
ResetBackColor()

Resets the Control.BackColor property to its default value.

override
ResetForeColor()

Resets the Control.ForeColor property to its default value.

SetSelected(int, bool)

Selects or clears the selection for the specified item in a System.Windows.Forms.ListBox.

override
ToString() : string

Returns a string representation of the System.Windows.Forms.ListBox.

Protected Methods

AddItemsCore(object[])

This member is obsolete, and there is no replacement.

CreateItemCollection() : ListBox.ObjectCollection

Creates a new instance of the item collection.

override
GetScaledBounds(System.Drawing.Rectangle, System.Drawing.SizeF, BoundsSpecified) : System.Drawing.Rectangle

Retrieves the bounds within which the System.Windows.Forms.ListBox is scaled.

override
OnChangeUICues(UICuesEventArgs)

Raises the Control.ChangeUICues event.

override
OnDataSourceChanged(EventArgs)

Raises the ListControl.DataSourceChanged event.

override
OnDisplayMemberChanged(EventArgs)

Raises the ListControl.DisplayMemberChanged event.

OnDrawItem(DrawItemEventArgs)

Raises the ListBox.DrawItem event.

override
OnFontChanged(EventArgs)

Raises the Control.FontChanged event.

override
OnHandleCreated(EventArgs)

Specifies when the window handle has been created so that column width and other characteristics can be set. Inheriting classes should call base.OnHandleCreated.

override
OnHandleDestroyed(EventArgs)

Overridden to be sure that items are set up and cleared out correctly. Inheriting controls should call base.OnHandleDestroyed.

OnMeasureItem(MeasureItemEventArgs)

Raises the ListBox.MeasureItem event.

override
OnParentChanged(EventArgs)

Raises the Control.ParentChanged event.

override
OnResize(EventArgs)

Raises the Control.Resize event.

override
OnSelectedIndexChanged(EventArgs)

Raises the ListControl.SelectedValueChanged event.

override
OnSelectedValueChanged(EventArgs)

Raises the ListControl.SelectedValueChanged event.

override
RefreshItem(int)

Refreshes the item contained at the specified index.

override
RefreshItems()

Refreshes all System.Windows.Forms.ListBox items and retrieves new strings for them.

override
ScaleControl(System.Drawing.SizeF, BoundsSpecified)

Scales a control's location, size, padding and margin.

override
SetBoundsCore(int, int, int, int, BoundsSpecified)

Sets the specified bounds of the System.Windows.Forms.ListBox control.

override
SetItemCore(int, object)

Sets the object with the specified index in the derived class.

override
SetItemsCore(IList)

Clears the contents of the System.Windows.Forms.ListBox and adds the specified items to the control.

Sort()

Sorts the items in the System.Windows.Forms.ListBox.

WmReflectCommand(ref Message)
Documentation for this section has not yet been entered.
override
WndProc(ref Message)
Documentation for this section has not yet been entered.

Public Events

BackgroundImageChanged

Occurs when the ListBox.BackgroundImage property of the label changes.

BackgroundImageLayoutChanged

Occurs when the ListBox.BackgroundImageLayout property changes.

Click

Occurs when the System.Windows.Forms.ListBox control is clicked.

DrawItem

Occurs when a visual aspect of an owner-drawn System.Windows.Forms.ListBox changes.

MeasureItem

Occurs when an owner-drawn System.Windows.Forms.ListBox is created and the sizes of the list items are determined.

MouseClick

Occurs when the user clicks the System.Windows.Forms.ListBox control with the mouse pointer.

PaddingChanged

Occurs when the value of the ListBox.Padding property changes.

Paint

Occurs when the System.Windows.Forms.ListBox control is painted.

SelectedIndexChanged

Occurs when the ListBox.SelectedIndex property or the ListBox.SelectedIndices collection has changed.

TextChanged

Occurs when the ListBox.Text property is changed.