欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

Delphi

當(dāng)前位置:主頁(yè) > 軟件編程 > Delphi >

Delphi用TActionList實(shí)現(xiàn)下載文件的方法

來源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:Delphi|點(diǎn)擊: 次

Delphi中的TActionList有個(gè)標(biāo)準(zhǔn)動(dòng)作TDownLoadURL,內(nèi)部是使用的URLDownloadToFile,它下載文件時(shí)會(huì)定時(shí)產(chǎn)生OnDownloadProgress 事件,這樣就可以用進(jìn)度條顯示。

本文講述了Delphi用TActionList實(shí)現(xiàn)下載文件的方法,實(shí)現(xiàn)代碼如下所示:

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtActns, ActnList, StdCtrls, ComCtrls;
 
type
 TForm1 = class(TForm)
  Button1: TButton;
  ActionList1: TActionList;
  ProgressBar1: TProgressBar;
  procedure Button1Click(Sender: TObject);
 private
  { Private declarations }
  procedure URL_OnDownloadProgress
       (Sender: TDownLoadURL;
       Progress, ProgressMax: Cardinal;
       StatusCode: TURLDownloadStatus;
       StatusText: String; var Cancel: Boolean) ;
 public
  { Public declarations }
 end;
 
var
 Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure Tform1.URL_OnDownloadProgress;
begin
  ProgressBar1.Max:= ProgressMax;
  ProgressBar1.Position:= Progress;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  with TDownloadURL.Create(self) do
  try
   URL:='//www.jb51.net/images/logo.gif';
   FileName := 'logo.gif';
   OnDownloadProgress := URL_OnDownloadProgress;
   ExecuteTarget(nil) ;
  finally
   Free;
  end;
  showMessage('OK');
  ProgressBar1.Max := 0;
end;

上一篇:Delphi實(shí)現(xiàn)木馬自我拷貝方法

欄    目:Delphi

下一篇:Delphi實(shí)例演示Rect、Bounds生成TRect的區(qū)別

本文標(biāo)題:Delphi用TActionList實(shí)現(xiàn)下載文件的方法

本文地址:http://mengdiqiu.com.cn/a1/Delphi/8628.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有