Setting or removing an image for an item


The image for an item can be set when an item is first added to the list view control.
m_listctrl.InsertItem( LVIF_TEXT | LVIF_IMAGE, nRow, sItemText, 0, 0, nImage, NULL);
The image can later be changed by calling the SetItem() function. The CListCtrl class does not have a SetImage() function.
m_listctrl.SetItem( 0, 0, LVIF_IMAGE, NULL, nImage, 0, 0, 0 );
To remove the image, use a value of -1 for nImage, else nImage should be a zero based index of the image in the image list.
 



Comments

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • Packaged application development teams frequently operate with limited testing environments due to time and labor constraints. By virtualizing the entire application stack, packaged application development teams can deliver business results faster, at higher quality, and with lower risk.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds