孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

//要加入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;

posted on 2008-09-13 11:29  孤独的猫  阅读(324)  评论(0编辑  收藏  举报