unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, ExtCtrls, Buttons;
type
TForm1 = class(TForm)
Animate1: TAnimate;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
bmp: TBitmap;
i: integer;
begin
bmp := TBitmap.Create;
bmp.Width := Animate1.FrameWidth;
bmp.Height := Animate1.FrameHeight;
for i := 1 to Animate1.FrameCount do
begin
// Animate1.Play(i, i, 1);
Animate1.Active := false;
Animate1.StartFrame := i;
Animate1.StopFrame := i;
Animate1.Active := true;
Animate1.Update;
//sleep(1000);
BitBlt(bmp.Canvas.Handle, 0, 0, bmp.Width, bmp.Height, getdc(Animate1.Handle), 0, 0, SRCCOPY);
bmp.PixelFormat := pf4bit;
bmp.SaveToFile('c:/' + inttostr(i) + '.bmp');
end;
freeandnil(bmp);
end;
end.
object Form1: TForm1
Left = 192
Top = 107
Width = 544
Height = 375
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Animate1: TAnimate
Left = 56
Top = 48
Width = 272
Height = 60
Active = False
CommonAVI = aviCopyFile
StopFrame = 26
end
object Button1: TButton
Left = 168
Top = 168
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
end