Aadi

Hi All,
I am working with listview and imagelist, and I am able to populate listview with images and data,but in one situatation I need to remove all images(imagelist) from the listview,
 when I remove images(imagelist) from the listview I want to make first column textalignment to left,

in my code even if I remove images(imagelist) I was not able to align the text to left. I wasnt able to remove the space what earlier occupied by images(imagelist).

I can clear that space by disposing the listview but I dont want dispose the listview,


I would appreciate if anyone gives me the solution

Thanks


Re: Windows Forms General Listview with Imagelist

Jason K

Try setting the ListView's Alignment Property to ListViewAlignment.Left after you remove the imagelist.

Jason




Re: Windows Forms General Listview with Imagelist

Aadi

HI,
I tried that too, but no luck.
once you assign  a valid imagelist to Listview as either the Normal or Small imagelist, the views that use  that imagelist size will continue to leave space for the image even if you reset the imagelist to NULL. I dont know of any way to make the listview forget. Nor do I know of any straightforward way to make the listview not use its imagelist and therefore not create space.


is there anyway to remove that spacce when I remove Imagelist from the Listview.

Thanks





Re: Windows Forms General Listview with Imagelist

Jason K

This works for me when using large and small image list




listView1.SmallImageList = null;

listView1.LargeImageList = null;

listView1.StateImageList = null;

///listView1.Alignment = ListViewAlignment.SnapToGrid;  Needed after first time

listView1.Alignment = ListViewAlignment.SnapToGrid;


 



The only problem is, if you want to put the image list back in and then remove it again, you have to change the Alignment to something else then back to ListViewAlignment.SnapToGrid after you set one of the ListView's ImageLists to null.

Jason
 






Re: Windows Forms General Listview with Imagelist

Aadi

Now its working perfectly


Thanks a lot Jason


Thanks






Re: Windows Forms General Listview with Imagelist

Eylem Ugurel

Hi Aadi, and Jason;

I have the same problem, but this time with CListView on Visual C++ 6.0 (SP6). I have no luck to use the "Alignment" property because such property does not exist neither for CListView, nor CListCtrl.

What should I do





Re: Windows Forms General Listview with Imagelist

rafik el kheer

thanks

rafik_elkheer@hotmail.com

rfk@har.com






Re: Windows Forms General Listview with Imagelist

ManishBirla

Hi Aadi,

I too working with image list and list view. but for me i'm not able to display image in list view. can you please help me. here i can see the text messgae but not image (bitmap in my case ).

here is the code snippet.

LvItem.mask=LVIF_TEXT | LVIF_IMAGE ; // Text Style

LvItem.cchTextMax = 256; // Max size of test

LvItem.iItem=0; // choose item

LvItem.iImage = 0;

LvItem.iSubItem=0;

wsprintf(wch,L"item%d",k);

LvItem.pszText=wch;

SendMessage(hList,LVM_INSERTITEM,0,(LPARAM)&LvItem);





Re: Windows Forms General Listview with Imagelist

Shyamsunder

hi Audi,

I am working with listview & imagelist, but i dont know how to add imagelist to Listview & populate the images, if u know these plz tell me about these.

Thank