Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. images in different columns in a listctrl

images in different columns in a listctrl

Scheduled Pinned Locked Moved C / C++ / MFC
learning
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    prateekkathuria
    wrote on last edited by
    #1

    hi, I want the list control to be able to have images in differnt columns( could be any column 0,1,2..) so i create a CIMAGELIST from some resource and also set it for the list control by calling the method m_listCtrl->SetImageList(&m_imagelistsmall, LVSIL_SMALL); What this does is set the images from the imagelist in column1( always). even when i dont specify the LVIF_IMAGE mask when adding item. I dont want the image in the first column. Also what do i do to have the image in other other columns

    G M 2 Replies Last reply
    0
    • P prateekkathuria

      hi, I want the list control to be able to have images in differnt columns( could be any column 0,1,2..) so i create a CIMAGELIST from some resource and also set it for the list control by calling the method m_listCtrl->SetImageList(&m_imagelistsmall, LVSIL_SMALL); What this does is set the images from the imagelist in column1( always). even when i dont specify the LVIF_IMAGE mask when adding item. I dont want the image in the first column. Also what do i do to have the image in other other columns

      G Offline
      G Offline
      Graham Bradshaw
      wrote on last edited by
      #2

      You can't do this with a Windows list control - it can only display icons in the first (left-most) column. You'll need a custom control to do what you want. A grid control that lets you put images in any cell might be the thing. Take a look at this control[^], here on CP. The chap who developed it is also a dab hand at web sites...

      A 1 Reply Last reply
      0
      • G Graham Bradshaw

        You can't do this with a Windows list control - it can only display icons in the first (left-most) column. You'll need a custom control to do what you want. A grid control that lets you put images in any cell might be the thing. Take a look at this control[^], here on CP. The chap who developed it is also a dab hand at web sites...

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Thanks. I made some of it possible and here is how i achieved it. I have an extended class of list ctrl. when i set the imagelist for the list it shows in the left most column by default so what i do is i do set the image in LVITEM but specify it to be some thing outside the range in the bitmap say 2000. This prevents the images to be shown in the left most column. Also for showing the image in some other column i use the LVS_EX_SUBITEMIMAGES extended style.

        1 Reply Last reply
        0
        • P prateekkathuria

          hi, I want the list control to be able to have images in differnt columns( could be any column 0,1,2..) so i create a CIMAGELIST from some resource and also set it for the list control by calling the method m_listCtrl->SetImageList(&m_imagelistsmall, LVSIL_SMALL); What this does is set the images from the imagelist in column1( always). even when i dont specify the LVIF_IMAGE mask when adding item. I dont want the image in the first column. Also what do i do to have the image in other other columns

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          That's how the control works - you always get an image in column 0 when you set an image list. To put images in other columns, set the LVS_EX_SUBITEMIMAGES extended style. Then when you insert new items, the control will look at the iImage field in the LVITEM and show the corresponding image. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ----

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups