我试图小图标在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(与方法记录)充满whene我加载文件,所以我需要的是刚刚从FileInfo的添加fileico到图像列表和树状显示
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;
所以哪里是probleme? ! 谢谢