zoukankan      html  css  js  c++  java
  • delphi 播放GIF动画

    delphi 新功能----------------

    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls,Vcl.Imaging.GIFImg;//一定要加这个不然编译通不过;
    
    type
      TForm1 = class(TForm)
        Main1: TImage;
        btn1: TButton;
        procedure btn1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    procedure TForm1.btn1Click(Sender: TObject); begin pic_path := ExtractFilePath(ParamStr(0)) + 'img\gif\loading.gif'; submit_btn_status_img.Picture.LoadFromFile(pic_path); // AnimationSpeed 设定动画速度,值越大,速度越快 TGIFImage(submit_btn_status_img.Picture.Graphic).AnimationSpeed := 300; TGIFImage(submit_btn_status_img.Picture.Graphic).Animate := True; end;


    2017-08-27补充:


    procedure TForm6.Button1Click(Sender: TObject);
    var
      MyGif: TGIFImage;
    begin
      MyGif := TGIFImage.Create;
      try
        MyGif.LoadFromFile('D:\ShopDaxiaProject\ShopdaxiaAllImg\loading\loading_142.gif');
        MyGif.AnimationSpeed := 300;
        MyGif.Animate := True;
    
        Image1.Picture.Assign(MyGif);
      finally
        MyGif.Free;
      end;
    end;
    
    procedure TForm6.Button2Click(Sender: TObject);
    var
      gif: TGIFImage;
      stream: TResourceStream;
    begin
      gif := TGIFImage.Create;
      stream := TResourceStream.Create(HInstance, 'GifImage_1', RT_RCDATA);
      try
        gif.LoadFromStream(stream);
        gif.AnimationSpeed := 300;
        gif.Animate := True;
        Image1.Picture.Assign(gif);
      finally
        gif.Free;
        stream.Free;
      end;
    end;
     
  • 相关阅读:
    python3.7.6安装爬虫akshare
    linux执行crotab是python脚本不生效解决方案
    centos7安装smb共享目录
    搜索引擎集群安装7.8-head-ik
    npm更换阿里源
    nginx访问静态文件不下载,修改默认流下载
    jenkins通过证书ssh访问代码解决方法
    redis创建密码
    微信二次分享时缩略图及描述信息丢失
    redis安装使用
  • 原文地址:https://www.cnblogs.com/del88/p/2336152.html
Copyright © 2011-2022 走看看