Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- TForm1 = class(TForm)
- Timer1: TTimer;
- ImageList1: TImageList;
- VirtualStringTree1: TVirtualStringTree;
- procedure Timer1Timer(Sender: TObject);
- procedure VirtualStringTree1GetImageIndex(Sender: TBaseVirtualTree; Node: PVirtualNode;
- Kind: TVTImageKind; Column: TColumnIndex; var Ghosted: Boolean; var ImageIndex: Integer);
- private
- FFrameIndex: Integer;
- public
- { Public declarations }
- end;
- implementation
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
- // your GIF image has 12, which is that magic 12 here
- FFrameIndex := (FFrameIndex + 1) mod 12;
- // you can invalidate only certain nodes with InvalidateNode method
- VirtualStringTree1.Invalidate;
- end;
- procedure TForm1.VirtualStringTree1GetImageIndex(Sender: TBaseVirtualTree; Node: PVirtualNode;
- Kind: TVTImageKind; Column: TColumnIndex; var Ghosted: Boolean; var ImageIndex: Integer);
- begin
- // if the tree requests image kind different from overlay, give it the current frame index
- if Kind <> ikOverlay then
- ImageIndex := FFrameIndex;
- end;
Advertisement
Add Comment
Please, Sign In to add comment