Painting a Icon in ListView in vsreport mode lazarus / 31-LCL ---------------------------------------------------------------------- BlueIcaro · 2018-10-29 11:16 Hi, I have a small application to show same information. See the image attached. I will like use a Icon in "Tipo" column. How can i do it? I see this example in stackflow but I couldn't work it on Lazarus 2.0 RC1. https://stackoverflow.com/questions/6612797/delphi-how-to-draw-small- icons-in-list-view-on-customdrawitem Any Idea? Thanks ---------------------------------------------------------------------- jamie · 2018-10-29 16:57 each TlistItem has a ImageIndex, StateIndex etc in it. You can create a TImageList, add the images you want to it and tell the ListView/TreeVew to use that ImageList. When you load your list, you need to specify the Image index for the listItem that is in that column.  I believe you can specify two image indexes so that you can have a different image depending on the state (StateIndex) ---------------------------------------------------------------------- BlueIcaro · 2018-11-02 13:01 Quote from: jamie on October 29, 2018, 05:57:29 pmeach TlistItem has a ImageIndex, StateIndex etc in it. You can create a TImageList, add the images you want to it and tell the ListView/TreeVew to use that ImageList. When you load your list, you need to specify the Image index for the listItem that is in that column.  I believe you can specify two image indexes so that you can have a different image depending on the state (StateIndex) How can I specify the image?, Using any event? /BlueIcaro ---------------------------------------------------------------------- jamie · 2018-11-02 13:50 you change the image index value of the node?  The images are referenced from a TimageList. each image you put in will represent the state you want.  so pick what ever event you want to use in the list and set the ImageIndex value in the Node to reflect the the condition you would like..   For example, if the row was locked you could put an image of a LOCK there , just change the ImageIndex..   I don't know how else to explain it to you.  P.S. node/Listitem ---------------------------------------------------------------------- lucamar · 2018-11-02 14:28 Quote from: BlueIcaro on November 02, 2018, 02:01:21 pmHow can I specify the image?, Using any event? /BlueIcaro You can, indeed, use almost any event but the best place to do it is when you create/add the TListItem or, if needed, when a list item changes its state. You should read the documentation for TListView and TListItem. ---------------------------------------------------------------------- BlueIcaro · 2018-11-02 15:12 Quote from: jamie on November 02, 2018, 02:50:24 pmyou change the image index value of the node?  The images are referenced from a TimageList. each image you put in will represent the state you want.  so pick what ever event you want to use in the list and set the ImageIndex value in the Node to reflect the the condition you would like..   For example, if the row was locked you could put an image of a LOCK there , just change the ImageIndex..   I don't know how else to explain it to you.  P.S. node/Listitem Thanks for your info. I did it as you say and it's works I assigned a image to the item as I created. Same thing like this: Code: [Select]     ListItem := Items.Add;       Listitem.Caption := 'Name' + IntToStr(I);       ListItem.ImageIndex := 1;       Listitem.SubItems.Add('Second name'); /BlueIcaro Quote from: lucamar on November 02, 2018, 03:28:41 pmQuote from: BlueIcaro on November 02, 2018, 02:01:21 pmHow can I specify the image?, Using any event? /BlueIcaro You can, indeed, use almost any event but the best place to do it is when you create/add the TListItem or, if needed, when a list item changes its state. You should read the documentation for TListView and TListItem. This example: http://docs.embarcadero.com/products/rad_studio/delphiAn dcpp2009/HelpUpdate2/EN/html/delphivclwin32/ComCtrls_TCustomListView_I tems.html was very useful for me /BlueIcaro