Q&A

  • [재질문]ListView 아이콘 넣기..(따라하기도 힘드네요)
procedure TForm1.FormCreate(Sender: TObject);

var

Search:TsearchRec;

Item:TlistItem;

il:Timagelist;

SHFileInfo,shFI:TSHFILEINFO;

begin

il:=Timagelist.create(self);

il.width:=16;

il.height:=16;

Listview1.SmallImages:=il;

Listview1.largeimages:=il;

Listview1.smallimages.shareImages:=true;

ListView1.SmallImages.handle:=SHGetFileInfo('C:*.*',0,SHFileInfo,sizeof(SHFileInfo),SHGFI_Icon or SHGFI_LargeIcon or SHGFI_SYSIconIndex);

If FindFirst('c:*.*',FaAnyFile,SearCh)=0 then

repeat

SHGetFileInfo(PChar('C:'+Search.name),0,ShFi,sizeof(ShFileInfo),SHGFI_ICON + SHGFI_LARGEICON + SHGFI_SYSICONINDEX + SHGFI_TYPENAME);

Item:=Listview1.Items.Add;

Item.caption:=Search.name;

item.imageindex:=ShFi.iIcon;

Item.subItems.add(IntToStr(SearCh.size));

Item.subItems.add(FormatDateTime('yyyy-mm-dd t',FileDateToDateTime(SearCh.Time)));

until FindNext(Search)<>0;

FindClose(Search);

end;





여러 고수님들의 조언에 따라 제가 이렇게 코딩을 해보았습니다.



아이콘은 없구 빈자리만 나오는디...무엇이 잘못
0  COMMENTS