Home > Software engineering >  Help: VB listview insert pictures in a column in a row, how do you write the code?
Help: VB listview insert pictures in a column in a row, how do you write the code?

Time:12-23

Such as topic, in order to realize the function of is, if send gifts, and insert a picture on the corresponding form, and request all code oh,,, thank you master,,, wondered for a long time,
The diagram below:

CodePudding user response:

You want to add pictures added to the ImageList,
Then bind ListView. ColumnHeaderIcons properties, such as:
 
ListView1. ColumnHeaders. Clear
ListView1. ColumnHeaderIcons=Nothing
ListView1. View=lvwReport

ImageList1. ListImages. Clear
1 icon ImageList1. ListImages. Add, "column", LoadPicture (" F: \ \ \ icon resources tools icon image resources \ 001. Ico ")
2 icon ImageList1. ListImages. Add, "column", LoadPicture (" F: \ \ \ icon resources tools icon image resources \ 002. Ico ")

ListView1. ColumnHeaderIcons=ImageList1
ListView1. ColumnHeaders. Add, "1", "1", 1200, 0, ImageList1. ListImages. Item (" column 1 icon "). The Index
ListView1. ColumnHeaders. Add, "column 2", "2", 1200, 0, ImageList1. ListImages. Item (" column 2 icon "). The Index
ListView1. ColumnHeaders. Add, "3", "3", 1200, 0, ImageList1. ListImages. Item (" column 1 icon "). The Index
ListView1. Refresh

  • Related