i am trying to add small icon to VirtualTreeview in delphi2010 i have ImageList attached to VirtualTreeview using the property images
procedure TMainFrm.VSTGetImageIndex(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: Integer);
var
FileInfo: PFileInfoRec;
begin
if Kind in [ikNormal , ikSelected] then
begin
if Column = 0 then
ImageIndex :=ImageList1.AddIcon(FileInfo.FileIco);
end;
end;
but after adding the icons look too dark:
FileInfo Strucutre (Record with methods) filled whene i load the files so what i need is just to add the fileico from fileinfo to imagelist and display in treeview
type
PFileInfoRec= ^TFileInfoRec;
TFileInfoRec = record
strict private
vFullPath: string;
.
.
.
vFileIco : TIcon;
public
constructor Create(const FilePath: string);
property FullPath: string read vFullPath;
.
.
.
property FileIco : TIcon read vFileIco;
end;
the constructor:
constructor TFileInfoRec.Create(const FilePath: string);
var
FileInfo: SHFILEINFO;
begin
vFullPath := FilePath;
.
.
.
vFileIco := TIcon.Create;
vFileIco.Handle := FileInfo.hIcon;
// vFileIco.Free;
end;
so where is the probleme ? ! thanks