CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Location
    Lat: 47.285235, Lon: 8.565238
    Posts
    293

    Question ListCtrl: Why is the image not displayed?

    Hi
    In my list control (report) I use an image list. It is 20 x 100 pixels (5 images). The image list works fine for the 1st col (iSubItem = 0).
    But now I'd like to set one of the images for the 2nd col (iSubItem = 1). Therefore I use the LVIF_IMAGE flag and set the number of the image. Then I call SetItem() which is executed successfully. But the image isn't displayed.

    What could be the reason? Any ideas?

    The list control is a derieved class and is created dynamically. Every image works for the 1st col, none for the 2nd. There's just the empty cell.

    Many thanks in advance!

    Holi

  2. #2
    igbrus is offline Elite Member Power Poster
    Join Date
    Aug 2000
    Location
    Los Angeles
    Posts
    4,658
    For subitems use LVIF_STATE and LVIS_STATEIMAGEMASK mask

    state
    Indicates the item's state, state image, and overlay image. The stateMask member indicates the valid bits of this member.
    Bits 0 through 7 of this member contain the item state flags. This can be one or more of the item state values.

    Bits 8 through 11 of this member specify the one-based overlay image index. Both the full-sized icon image list and the small icon image list can have overlay images. The overlay image is superimposed over the item's icon image. If these bits are zero, the item has no overlay image. To isolate these bits, use the LVIS_OVERLAYMASK mask. To set the overlay image index in this member, you should use the INDEXTOOVERLAYMASK macro. The image list's overlay images are set with the ImageList_SetOverlayImage function.

    Bits 12 through 15 of this member specify the state image index. The state image is displayed next to an item's icon to indicate an application-defined state. If these bits are zero, the item has no state image. To isolate these bits, use the LVIS_STATEIMAGEMASK mask. To set the state image index, use the INDEXTOSTATEIMAGEMASK macro. The state image index specifies the index of the image in the state image list that should be drawn.

  3. #3
    Join Date
    May 1999
    Location
    Lat: 47.285235, Lon: 8.565238
    Posts
    293

    to igbrus

    I found out meanwhile what the error was: I had to set the LVS_EX_SUBITEMIMAGES style. Now it works. Unfortunately the SetItem() method returns successfully although this style isn't set... :-(

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured