开发者

Use HWND (or something similar) as Node Image in Virtual Stringtree

Is it possible to display an Icon obtained f开发者_开发技巧rom an external Handle, as the Image of my Node in Virtual Stringtree? The Node's Data contains the HWND.


I would use ImageList assigned to your VT's Images property and OnGetImageIndex event. Here's how to fill the image list using WM_GETICON.

procedure TForm1.Button1Click(Sender: TObject);
var IconHandle: HIcon;

begin
  IconHandle := SendMessage(123456, WM_GETICON, ICON_SMALL2, 0);
  ImageList_AddIcon(ImageList1.Handle, IconHandle);
end;

And for example pass the 0 image index to the VirtualTreeView.

procedure TForm10.VirtualStringTree1GetImageIndex(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
  var Ghosted: Boolean; var ImageIndex: Integer);
begin
  ImageIndex := 0;
end;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜