Delphi의 TActionList에는 내부적으로 URLDownloadToFile을 사용하는 표준 액션 TDownLoadURL이 있습니다. 파일을 다운로드할 때 정기적으로 OnDownloadProgress 이벤트를 생성하여 진행률 표시줄과 함께 표시할 수 있습니다.
이 문서에서는 Delphi가 TActionList를 사용하여 파일을 다운로드하는 방법을 설명합니다. 구현 코드는 다음과 같습니다.
Windows, 메시지, SysUtils, 변형, 클래스, 그래픽, 컨트롤, 양식, 대화 상자, ExtActns, ActnList, StdCtrls, ComCtrls를 사용합니다. type TForm1 = class(TForm) Button1: TButton: TActionList; TProgressBar; : TObject); private { 개인 선언 } 프로시저 URL_OnDownloadProgress (발신자: TDownLoadURL; Progress, ProgressMax: Cardinal; StatusCode: TURLDownloadStatus; StatusText: String; var Cancel: Boolean) var Form1: TForm1; 구현 {$R *.dfm} 절차 Tform1.URL_OnDownloadProgress ;시작 ProgressBar1.Max:= ProgressMax; 진행;끝; 절차 TForm1.Button1Click(Sender: TObject); TDownloadURL.Create(self)로 시작 URL:='//www.VeVB.COm/images/logo.gif'; '; OnDownloadProgress := URL_OnDownloadProgress(nil) ; 최종적으로 해제됨; ProgressBar1.Max := 0;끝;