TLama

Untitled

May 11th, 2014
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.07 KB | None | 0 0
  1. type
  2.   TForm1 = class(TForm)
  3.     Timer1: TTimer;
  4.     ImageList1: TImageList;
  5.     VirtualStringTree1: TVirtualStringTree;
  6.     procedure Timer1Timer(Sender: TObject);
  7.     procedure VirtualStringTree1GetImageIndex(Sender: TBaseVirtualTree; Node: PVirtualNode;
  8.       Kind: TVTImageKind; Column: TColumnIndex; var Ghosted: Boolean; var ImageIndex: Integer);
  9.   private
  10.     FFrameIndex: Integer;
  11.   public
  12.     { Public declarations }
  13.   end;
  14.  
  15. implementation
  16.  
  17. procedure TForm1.Timer1Timer(Sender: TObject);
  18. begin
  19.   // your GIF image has 12, which is that magic 12 here  
  20.   FFrameIndex := (FFrameIndex + 1) mod 12;
  21.   // you can invalidate only certain nodes with InvalidateNode method
  22.   VirtualStringTree1.Invalidate;
  23. end;
  24.  
  25. procedure TForm1.VirtualStringTree1GetImageIndex(Sender: TBaseVirtualTree; Node: PVirtualNode;
  26.   Kind: TVTImageKind; Column: TColumnIndex; var Ghosted: Boolean; var ImageIndex: Integer);
  27. begin
  28.   // if the tree requests image kind different from overlay, give it the current frame index
  29.   if Kind <> ikOverlay then
  30.     ImageIndex := FFrameIndex;
  31. end;
Advertisement
Add Comment
Please, Sign In to add comment