Einzelnen Beitrag anzeigen

tomkupitz

Registriert seit: 26. Jan 2011
323 Beiträge
 
Delphi 11 Alexandria
 
#8

AW: ListView Icon Transparenz Problem

  Alt 21. Okt 2018, 21:15
Ein FileListView geht so: (Abriss)

Code:
var ImageList: TImageList;

...

var sfi: TShFileInfo;

ImageList:=TImageList.Create(nil);
ImageList.Handle:=SHGetFileInfo(PChar(GetWinDir), 0, sfi, sizeof(TShFileInfo), SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
ImageList.ShareImages:=True;
ImageList.BkColor:=clNone;
ImageList.BlendColor:=clNone;

...

ListView1.SmallImages:=ImageList;

...

var sfi: TShFileInfo;

SHGetFileInfo(PChar(FileName), 0, sfi, sizeof(TSHFileInfo), SHGFI_SYSICONINDEX or SHGFI_SMALLICON);

with ListView1.Items.Add do
begin
  Caption:=ExtractFileName(FileName);
  ...
  ImageIndex:=sfi.iIcon;
end;

...

ImageList.Free;
  Mit Zitat antworten Zitat