开发者

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

开发者 https://www.devze.com 2023-03-04 15:47 出处:网络
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 y

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

精彩评论

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

关注公众号