Put picture before ListViewItem

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2008
Posts: 173
Reputation: Lukezzz is an unknown quantity at this point 
Solved Threads: 1
Lukezzz Lukezzz is offline Offline
Junior Poster

Put picture before ListViewItem

 
0
  #1
Nov 4th, 2008
How is it possible to put a picture before the listviewItem.
Under C: I have a picture.bmp that I would want before "Item" in
the listView1. I use "details" as for the property in the listView.

"Item" comes up 5 times in a List but no picture.
What could I be doing wrong ?


  1. for( int i = 0; i < 5; i++)
  2. {
  3. ImageList^ imageListSmall = gcnew ImageList;
  4. imageListSmall->Images->Add( Bitmap::FromFile( "C:\\picture.bmp" ) );
  5.  
  6.  
  7. listView1->Items->Add("Item");
  8. listView1->SmallImageList = imageListSmall;
  9. }
Last edited by Lukezzz; Nov 4th, 2008 at 7:05 pm.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 173
Reputation: Lukezzz is an unknown quantity at this point 
Solved Threads: 1
Lukezzz Lukezzz is offline Offline
Junior Poster

Re: Put picture before ListViewItem

 
0
  #2
Nov 5th, 2008
I have added 2 columns in the listView and when running the code above, the listview makes a space where the picture should have come, but the space is white and emty.
The picture I use is a .bmp 16x16.

In the code I should have been created an ImageList^ ,then as I understand I have
Assigned the ImageList to the ListView SmallImageList property and finally I have
Assigned for each listviewitem in the listview an image index to their
ImageIndex property.


I have not really any idéa what to change or add in this code. I am googling around but cant find any good answer.
Last edited by Lukezzz; Nov 5th, 2008 at 2:19 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC