Class VirtualListBox
Advanced list box control with ability to customize item painting. This control enables you to display a list of items to the user that the user can select by clicking. Works fine with large number of the items. You can add ListControlItem items to this control.
public class VirtualListBox : VirtualListControl, IBaseObjectWithAttr, IBaseObjectWithId, INotifyPropertyChanged, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, INotifyDataErrorInfo, IReadOnlyStrings, IListControlItemContainer, IListControlItemDefaults, ICheckListBox<ListControlItem>, ICustomListBox<ListControlItem>, IListControl<ListControlItem>, IListControl, IControl, IDisposable, IWin32Window, ILayoutItem, IScrollEventRouter, IListBoxActions
- Inheritance
-
VirtualListBox
- Implements
- Derived
Remarks
This control can provide single or multiple selections using the SelectionMode property. The BeginUpdate() and EndUpdate() methods enable you to add a large number of items without the control being repainted each time an item is added to the list. The Items, SelectedItems and SelectedIndices properties provide access to the three collections that are used by the control.
Constructors
- VirtualListBox()
Initializes a new instance of the VirtualListBox class.
- VirtualListBox(Control)
Initializes a new instance of the VirtualListBox class.
Fields
- DefaultFullItemToolTipBackColor
Gets or sets the default background color of the full item tooltip.
- DefaultFullItemToolTipBorderColor
Gets or sets the default border color of the full item tooltip.
- DefaultFullItemToolTipForeColor
Gets or sets the default foreground color of the full item tooltip text.
- DefaultRenderingFlags
Represents the default rendering flags for VirtualListBox and it's descendants.
Properties
- ContextMenu
Alias for ContextMenuStrip property.
- Count
Gets the number of items contained in the control.
- DefaultSetItemsKind
Gets or sets the way how items are set when Default is specified in SetItemsFast(BaseCollection<ListControlItem>, SetItemsKind). Default is ChangeField.
- DrawMode
Gets or sets the drawing mode for the control.
- EmptyText
Gets or sets the text displayed when the collection of items is empty.
- FullItemToolTipBackColor
Gets or sets the background color of the full item tooltip. Default is
null, which means DefaultFullItemToolTipBackColor will be used.
- FullItemToolTipBorderColor
Gets or sets the border color of the full item tooltip. Default is
null, which means DefaultFullItemToolTipBackColor will be used.
- FullItemToolTipForeColor
Gets or sets the foreground color of the full item tooltip text. Default is
null, which means DefaultFullItemToolTipForeColor will be used.
- HorizontalExtent
Gets or sets the width by which the horizontal scroll bar can scroll.
- IsPartialRowVisible
Gets or sets a value indicating whether partially visible rows are painted.
- ItemsLastPainted
Gets the items that were last painted in the control.
- NeedsFullItemToolTip
Gets or sets a value indicating whether an item tooltip is shown for items that don't fit in the control's view. Default is
true.
- ScrollEventRouter
Gets the router responsible for handling scroll events.
- ScrollOffsetX
Gets the horizontal scroll offset.
- TopIndex
Gets or sets the index of the first visible item in the control.
- UserPaint
Gets or set a value indicating whether the control paints itself rather than the operating system doing so.
- VisibleCount
Gets number of visible items.
Methods
- AddRange(IEnumerable)
Adds a collection of items to the list control.
- AddSeparator()
Adds a separator item to the control.
- CalcScrollBarInfo(out ScrollBarInfo, out ScrollBarInfo)
Calculates and retrieves information about the horizontal and vertical scroll bars.
- CountChanged()
Responds to changes in the item count by updating the scrollbars and invalidating the control.
- DefaultPaint(PaintEventArgs)
Default painting method of the UserControl and its descendants.
- DoActionScrollCharLeft()
Scrolls the control horizontally by one char to the left.
- DoActionScrollCharRight()
Scrolls the control horizontally by one char to the right.
- DoActionScrollLineDown()
Scrolls the control down by one line.
- DoActionScrollLineUp()
Scrolls the control up by one line.
- DoActionScrollPageDown()
Scrolls the control down by one page.
- DoActionScrollPageLeft()
Scrolls the control horizontally by one page to the left.
- DoActionScrollPageRight()
Scrolls the control horizontally by one page to the right.
- DoActionScrollPageUp()
Scrolls the control up by one page.
- DoActionScrollToFirstChar()
Scrolls the control horizontally to the first char.
- DoActionScrollToFirstLine()
Scrolls to the first line in the control.
- DoActionScrollToHorzPos(int)
Sets horizontal scroll offset.
- DoActionScrollToLastLine()
Scrolls to the last line in the control.
- DoActionScrollToVertPos(int)
Sets vertical scroll offset.
- DoHandleItemClick(int, ItemClickFlags)
Handles the logic for item selection when an item is clicked.
- EditItemsWithListEditor()
Shows list editor dialog which allows to edit items.
- EndUpdate()
Resumes painting the control after painting is suspended by the BeginUpdate() method.
- EnsureVisible(int)
Makes item with the specified index visible in the control's view.
- FindAndSelect(string?, int?, bool, bool)
Returns the index of the first item in the control beyond the specified index that contains or equal the specified string.
- FindFirstVisibleFromLast(int, bool)
Finds first visible item from the specified last visible item.
- FindItemIndex(ListControlItem?)
Searches for the specified item within the current list and returns its index if found.
- FindItemIndexWithValue(object?)
Finds the index of the item with Value property which is equal to the specified value.
- FindItemWithValue(object?)
Finds the item with Value property which is equal to the specified value.
- GetCharWidth()
Retrieves the width of a single character using the font returned by GetItemFont(int, bool).
- GetDefaultRenderingFlags()
Retrieves the default rendering flags for the control.
- GetIndexOnNextPage(int?)
Gets the index of the first item on the next page relative to the specified index.
- GetIndexOnPreviousPage(int?)
Gets the index of the first item on the previous page relative to the specified index.
- GetItemRect(int?)
Gets the rectangle that represents the bounds of the item at the specified index.
- GetRenderedItemCount()
Gets the number of items currently rendered in the control.
- GetVisibleBegin()
Gets index of the first visible item.
- GetVisibleEnd()
Determines the index of the last visible item in the control.
- GetVisibleEnd(out float, out float)
Determines the index of the last visible item in the control and calculates the total height and maximal width of visible items.
- HitTest(PointD)
Returns the zero-based index of the item at the specified coordinates.
- HitTestCheckBox(PointD)
Returns the zero-based index of the item, if specified coordinates are over checkbox; otherwise returns
null.
- IncHorizontalOffset(int)
Increments horizontal scroll offset.
- IncHorizontalOffsetChars(int)
Increments horizontal scroll offset on the value specified in characters.
- IsItemVisible(int)
Gets whether item with the specified index is visible.
- ItemsCollectionChanged(object?, NotifyCollectionChangedEventArgs)
Callback which is called when items are changed in the control.
- MeasureItemSize(MeasureItemEventArgs)
Measures item size. If ItemPainter is assigned, uses GetSize(object, int), otherwise calls DefaultMeasureItemSize(IListControlItemContainer, Graphics, int). Additionally calls MeasureItem event and OnMeasureItem(MeasureItemEventArgs) method if drawing mode is not Normal.
- MeasureItemSize(int)
Measures the size of an item at the specified index.
- OnDpiChanged(DpiChangedEventArgs)
Called when the DpiChanged event is raised.
- OnDrawItem(DrawItemEventArgs)
Called when DrawItem event is raised.
- OnGotFocus(EventArgs)
This method is invoked when the control gets focus.
- OnKeyDown(KeyEventArgs)
Called when the KeyDown event is raised.
- OnLostFocus(EventArgs)
This method is invoked when the control lost focus.
- OnMeasureItem(MeasureItemEventArgs)
Called when the MeasureItem event is raised.
- OnMouseDoubleClick(MouseEventArgs)
Called when the mouse button was double-clicked.
- OnMouseHover(EventArgs)
Called when the mouse pointer hovers over the control.
- OnMouseLeftButtonDown(MouseEventArgs)
Called when the left mouse button was pressed.
- OnMouseMove(MouseEventArgs)
Called when the mouse is moved.
- OnSystemColorsChanged(EventArgs)
Called when the SystemColorsChanged event is raised.
- RaiseDrawItem(DrawItemEventArgs)
Raises DrawItem event and OnDrawItem(DrawItemEventArgs) method.
- RaiseMeasureItem(MeasureItemEventArgs)
Raises MeasureItem event and OnMeasureItem(MeasureItemEventArgs) method.
- RefreshLastRow()
Refreshes the last row in the control.
- RefreshRow(int)
Triggers a refresh for just the given row's area of the control if it is visible.
- RefreshRows(int, int)
Triggers a refresh for the area between the specified range of rows given (inclusively).
- RemoveAll()
Removes all items from the control.
- RemoveSelectedAndUpdateSelection()
Removes selected items and updates selection so the closest item to the previous selection will become selected.
- ResetCachedImages()
Clears all cached images associated with the current instance. Normally, this method is called automatically when the control's DPI settings change or system colors change.
- ResetCachedImagesInItems()
Resets the cached images for all items in the collection. This method is called from ResetCachedImages() to clear the cached images for all items.
- RunKeyDown(Key, ModifierKeys)
Simulates the key press event by creating and dispatching a KeyEventArgs.
- ScrollRowPages(int)
Scroll by the specified number of pages which may be positive (to scroll down) or negative (to scroll up).
- ScrollRows(int)
Scroll by the specified number of rows which may be positive (to scroll down) or negative (to scroll up).
- ScrollToFirstRow()
Scrolls control to the first row.
- ScrollToLastRow()
Scrolls control to the last row.
- ScrollToRow(int, bool)
Scrolls to the specified row.
- SelectFirstItemAndScroll()
Selects the first item in the tree view control and scrolls to it.
- SelectItemAndScroll(ListControlItem?)
Selects the specified item in the list and scrolls it into view if necessary.
- SelectItemAndScroll(int?)
Selects an item at the specified index and scrolls to make it visible.
- SelectItemOnNextPage()
Selects item on the next page.
- SelectItemOnPreviousPage()
Selects item on the previous page.
- SelectItemsAndScroll(params int[])
Selects items with the specified indexes and scrolls the control so the first selected item will become visible in the view.
- SelectLastItemAndScroll()
Selects last item in the control and scrolls the control so last item will be visible.
- SelectNextItem()
Selects next item.
- SelectPreviousItem()
Selects previous item.
- SetHorizontalOffsetChars(int)
Sets horizontal scroll offset to the value specified in characters.
- SetItemsFast(BaseCollection<ListControlItem>, SetItemsKind)
Sets items to the new value using the specified method.
- SetItemsFast<TItemFrom>(IEnumerable<TItemFrom>, Action<ListControlItem, TItemFrom>)
Sets items from the specified collection to the control's items as fast as possible.
- SetItemsFastest(BaseCollection<ListControlItem>)
Sets items to the new value using the fastest method.
- ToggleItemCheckState(PointD)
Toggles checked state of the item at the specified coordinates.
- ToggleItemCheckState(int)
Changes item CheckState to the next value.
Events
- DrawItem
Occurs when a visual aspect of an owner-drawn control is changed.
- MeasureItem
Occurs when the sizes of the list items are determined.