|
How to Autosize ListView columns ?
|
Total Hit (10252) |
This demo will show you how to auto fit all ListView items.
«b»Step-By-Step Example«/b»
- Create a standard exe project
- Add ListView control on the form1. To add ListView control you need to add reference to Microsoft Windows Common Control 5.0 (Click Project->Components)
- Place the follo
....Read More |
Rating
|
|
|
Extending the functionality of the VB ListView controls
|
Total Hit (2104) |
The "ListView" control in both Comctl32.ocx and Mscomctl.ocx is simply a wrapper that superclasses (encapsulates) the real "listview" common control in Comctl32.dll. This allows the real listview common control messages and definitions to be used to override almost every aspect of the VB ListView co
....Read More |
Rating
|
|
|
How to Automatically Select (Track) a ListView Item
|
Total Hit (1356) |
By setting a ListView extended style bit using the API SendMessage with the message LVS_EX_TRACKSELECT, the ListView action changes. While a cursor is moving over the listview items, it is highlighted in coloured text (look at the line below the selection in the illustration.) If the cursor remains
....Read More |
Rating
|
|
|
How to Add Checkboxes to a ListView
|
Total Hit (1246) |
This page demonstrates adding the ability to have checkmarks to the left of the item icon in report view. Under Win95 the check boxes are not not pretty.
By setting a ListView extended style bit using the API SendMessage with the message LVS_EX_CHECKBOXES, the ListView rows will have a left-most
....Read More |
Rating
|
|
|
How to Add Images to a ListView Header
|
Total Hit (921) |
In most Windows applications, a visual indication of the sorting direction of the currently active listview column header is indicated by an up or down arrow. This functionality has previously been unavailable to the Visual Basic developer. The method detailed here demonstrates the steps to add your
....Read More |
Rating
|
|
|
How to Change the ListView Header Style
|
Total Hit (1736) |
Depending on the needs of your application, the standard header font of a listview may prove inadequate for your needs. Unfortunately, the listview API structures and constants do not provide a direct means to specify the font attributes of the header. But by using several standard API functions not
....Read More |
Rating
|
|
|
How to Determine Selected ListItems
|
Total Hit (1284) |
A quick routine to demonstrate using SendMessage with LVM_GETSELECTEDCOUNT and LVM_GETNEXTITEM messages to traverse a listview to retrieve the indices to the selected items in a MultiSelect control. Also contains a portion of the LVM_SUBITEMHITTEST code from How to Deselect ListItems on Clicking a L
....Read More |
Rating
|
|
|
|
How to Display Grid Lines in a ListView
|
Total Hit (1229) |
By setting a ListView extended style bit using the API SendMessage with the message LVS_EX_GRIDLINES, the ListView columns and rows will be separated by a grey grid line.
|
Rating
|
|
|
How to Programmatically Select and Deselect All ListItems
|
Total Hit (1359) |
Using conventional methods, selecting and deselecting all items in a ListView typically involves iterating through the ListItems collection to set each item's selected property. By utilizing the SendMessage API with LVIS_SELECTED, this monotony can be reduced to a single call.
Note that this meth
....Read More |
Rating
|
|
|
How to Reorder ListView Columns Programmatically
|
Total Hit (1320) |
We have seen how to allow the user to reorder columns by sending the HEADERDRAGDROP message. The listview control provides another means to reorder the report view columns - programmatically via the COLUMNORDERARRAY message. This page demonstrates this technique.
The principle is simple. We dim
....Read More |
Rating
|
|
|
How to Select the Entire Row in a ListView
|
Total Hit (1503) |
By setting a ListView style bit using the Windows API SendMessage with the message LVS_EX_FULLROWSELECT, selecting an item will cause the selection rectangle to highlight and span the entire row. Removing this bit restores the default selection style.
....Read More |
Rating
|
|
|
How to Set Item Indentation in a ListView
|
Total Hit (718) |
Many people erroneously believe that the 'control' used in displaying hierarchical data such as Outlook Express' news reader view is a treeview control with columns. Actually, the control is a ListView taking advantage of the comctl version 4-specific Indent member of the LV_ITEM structure. This pag
....Read More |
Rating
|
|
|
How to Show SubItem Icons in the ListView
|
Total Hit (792) |
In perhaps the strangest (and most useless) of extended example, this code adds to each subitem the same icon displayed as the main item icon. I have yet to determine how (or if) a subitem-specific icon can be shown instead of duplicating the main item icon, or frankly, why one would ever want this
....Read More |
Rating
|
|
|
How to Toggle a Checkbox in a ListView
|
Total Hit (703) |
The routines here set and retrieve checked ListItems from a ListView control in report view.
Basically, here we are again using the enhanced comctl32.dll functionality, this time using the LVIS_STATEIMAGEMASK and LVIF_STATE to toggle the bits at &H1000 and &H2000. In addition, by using the messag
....Read More |
Rating
|
|
|
Simulating a TopIndex Property for a ListView
|
Total Hit (693) |
A listview control's EnsureVisible method provides a means to bring a referenced item into view. Ditto, the LVM_ENSUREVISIBLE message simply "ensures that a list-view item is either entirely or partially visible, scrolling the list-view control if necessary."
If the item of interest is back up t
....Read More |
Rating
|
|
|
Subclassing Listview Scrollbar Messages
|
Total Hit (883) |
When it is necessary for your application to maintain synchronization between two or more Listview controls - or two or more List boxes for that matter - as the user interacts with the primary ListView's control's scrollbar, subclassing must be used in order to determine the user's interaction refle
....Read More |
Rating
|
|
|
Using the ListView Checkbox
|
Total Hit (1154) |
By popular demand, here are several methods you can employ to perform a variety of ListView check box-related operations.
Setcheck: turns on the checkbox for the item passed as the value in the textbox.
GetChecked: displays a MsgBox with a list of currently-selected checked items and their List
....Read More |
Rating
|
|
|
Tutorial - ListView Control Introduction
|
Total Hit (1692) |
The list view control is basically and advanced ListBox. This control allows you to add rows of data, but it also supports large and small icons, multiple columns, automatic label edit, column re-order, hot-tracking, the four main modes that you see in explorer:
Icon - Displays items with large i
....Read More |
Rating
|
|