我正在尝试在delphi2010中向VirtualTreeview添加小图标我使用属性图像将ImageList附加到VirtualTreeview
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;
但添加图标后看起来太暗了:
FileInfo Strucutre (Record with methods) 在我加载文件时填充,所以我需要的只是将 fileico 从 fileinfo 添加到 imagelist 并显示在树视图中
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;
构造函数:
constructor TFileInfoRec.Create(const FilePath: string);
var
FileInfo: SHFILEINFO;
begin
vFullPath := FilePath;
.
.
.
vFileIco := TIcon.Create;
vFileIco.Handle := FileInfo.hIcon;
// vFileIco.Free;
end;
那么问题在哪里?!谢谢