OdListVw.exe Highlights Entire Row in a ListView Control

ID: Q131788


The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), used with:
    • Microsoft Windows NT 3.51
    • Microsoft Windows 95
    • Microsoft Win32s version 1.3
  • Microsoft Windows 2000


SUMMARY

One of the limitations of the ListView common control is that when the control is in report view, the control only highlights the first column when a row is selected. To work around this limitation, you can create the ListView as an owner draw control (using the LVS_OWNERDRAWFIXED style) and perform all the painting yourself.

The ODLISTVW sample demonstrates how to create an owner draw ListView control that highlights an entire row.


MORE INFORMATION

The following file is available for download from the Microsoft Download Center. Click the file name below to download the file:

Odlist.exe
For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center. One of the supported styles for the ListView control is LVS_OWNERDRAWFIXED, which allows the program to perform all the drawing of items in the ListView control. Whenever the ListView control needs to have a portion of the control repainted, it calculates which items are in that area and sends a WM_DRAWITEM message to its parent for each item. If any part of an item needs to be redrawn, the ListView sends the WM_DRAWITEM with the update rectangle set to the entire item.

The ListView control handles owner drawn items differently from other owner drawn controls. Previous owner drawn controls use the DRAWITEMSTRUCT's itemAction field to let the parent know if it needs to draw the item, change the selected state, or change the focus state. The ListView control always sends the WM_DRAWITEM message with the itemAction set to ODA_DRAWENTIRE. The parent needs to check the itemState to see if the focus or selection needs to be updated.

The LVS_OWNERDRAWFIXED style is only compatible with the LVS_REPORT style. You cannot have an owner drawn ListView with the LVS_ICON, LVS_SMALLICON or LVS_LIST style.

Additional query words: CListCtrl CListView list control kbui kbfile

Keywords : kbfile kbsample kbCtrl kbNTOS351 kbWinOS2000 kbSDKWin32 kbGrpUser kbWinOS95
Version : WINDOWS:; winnt:3.51
Platform : WINDOWS winnt
Issue type : kbinfo


Last Reviewed: February 2, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.