//要加入GIFImage单元
procedure TxtToGIF(txt,FileName:string;Img:TImag);
var
temp:TBitmap;
GIF:TGIFImage;
begin
temp :=TBitmap.Create;
try
temp.Height :=400;
temp.Width :=60;
temp.Transparent :=True;
temp.Canvas.Brush.Color :=clWhite;
temp.Canvas.Font.Name :='宋体';
temp.Canvas.Font.Color :=clBlue;
temp.Canvas.TextOut(10,10,txt);
Ima.Picture.Assign(nil);
GIF :=TGIFImage.Create;
try
GIF.Assign(temp);
GIF.SaveToFile(FileName);
Img.Picture.Assign(GIF);
finally
GIF.Free;
end;
finally
temp.Destroy;
end;
end;