__fastcall Tform1::tform1 (tcomponent*owner): Tform (owner) {//load icon to ImageListGraphics::tbitmap *bmppicture =NULL; Bmppicture=NewGraphics::tbitmap; Bmppicture->loadfromfile (L"file001.bmp"); ImageList1-Add (bmppicture,bmppicture); Bmppicture=NewGraphics::tbitmap; Bmppicture->loadfromfile (L"file002.bmp"); ImageList1-Add (bmppicture,bmppicture); Bmppicture=NewGraphics::tbitmap; Bmppicture->loadfromfile (L"file003.bmp"); ImageList1-Add (bmppicture,bmppicture); Bmppicture=NewGraphics::tbitmap; Bmppicture->loadfromfile (L"file004.bmp"); ImageList1-Add (bmppicture,bmppicture); Bmppicture=NewGraphics::tbitmap; Bmppicture->loadfromfile (L"file005.bmp"); ImageList1-Add (bmppicture,bmppicture); Bmppicture=NewGraphics::tbitmap; Bmppicture->loadfromfile (L"file006.bmp"); ImageList1-Add (bmppicture,bmppicture); Tlistcolumn*ListColumn; Tlistitem*ListItem; ListView1->width =504; //set up header informationListColumn = listview1->columns->Add (); ListColumn->caption ="name"; ListColumn->width = -; ListColumn= listview1->columns->Add (); ListColumn->caption ="Sex"; ListColumn->width = -; ListColumn= listview1->columns->Add (); ListColumn->caption ="Age"; ListColumn->width = -; ListColumn= listview1->columns->Add (); ListColumn->caption ="Date of birth"; ListColumn->width = -; ListColumn= listview1->columns->Add (); ListColumn->caption ="Contact Information"; ListColumn->width = -; Const Char*sex[4]={"male","female"}; //Add InformationListItem = listview1->items->Add (); ListItem->caption ="Li Ming"; ListItem->imageindex =0; ListItem->subitems->add (sex[0]); ListItem->subitems->add (" at"); ListItem->subitems->add ("1993-04-11"); ListItem->subitems->add ("13435987873"); ListItem= listview1->items->Add (); ListItem->caption ="Zhang Jing"; ListItem->imageindex =1; ListItem->subitems->add (sex[1]); ListItem->subitems->add (" +"); ListItem->subitems->add ("1991-06-71"); ListItem->subitems->add ("12345666434"); ListItem= listview1->items->Add (); ListItem->caption =" Wang Hong"; ListItem->imageindex =2; ListItem->subitems->add (sex[1]); ListItem->subitems->add (" at"); ListItem->subitems->add ("1995-01-10"); ListItem->subitems->add ("13655941178"); ListItem= listview1->items->Add (); ListItem->caption ="Sun Zhiming"; ListItem->imageindex =3; ListItem->subitems->add (sex[0]); ListItem->subitems->add (" -"); ListItem->subitems->add ("1991-06-11"); ListItem->subitems->add ("13859878172"); ListItem= listview1->items->Add (); ListItem->caption ="Lin Xi"; ListItem->imageindex =4; ListItem->subitems->add (sex[0]); ListItem->subitems->add (" -"); ListItem->subitems->add ("1992-02-21"); ListItem->subitems->add ("13882123378"); ListView1->viewstyle =VSReport; //Listview1->viewstyle = Vsicon; //Listview1->viewstyle = vslist; //listview1->viewstyle = Vssmallicon;Listview1->largeimages =ImageList1; ListView1->smallimages =ImageList1;}
:
The Viewstyle property is changed to Csicon effect:
Timagelist and TListView components (C++builder)