几行代码搞定!<br>procedure ShowFile(const FileName: TFileName);<br>var<br> Item: TListItem;<br> Icon: TIcon;<br> piIcon: word;<br> iIndex: integer;<br>begin<br> Icon := TIcon.Create;<br> Icon.Handle := ExtractAssociatedIcon(HInstance, pchar(FileName), piIcon);<br> iIndex := ImageListAttachment.AddIcon(Icon);<br> Icon.Free;<br> Item := ListViewAttachment.Items.add;<br> Item.Caption := FileName;<br> Item.ImageIndex := iIndex;<br>end;