TAction // TEditCut、TEditCopy、TEditPaste、TEditSelectAll、TEditUndo、TEditDelete、TEditSelectAll、TEditSelectAll TWindowAction // TWindowClose、TWindowCascade、TWindowTileHorizontal、TWindowTileVertical、TWindowMinimizeAll、TWindowArrange THelpAction // THelpContents、THelpTopicSearch、THelpOnHelp、THelpContextAction TFileAction // TFileOpenWith、TFileSaveAs、TFilePrintSetup、TFilePageSetup、TFileExit TSearchFind //
使用 TBrowseURL 打开网页:
uses ExtActns; procedure TForm1.Button1Click(Sender: TObject); begin with TBrowseURL.Create(nil) do begin URL := 'http://del.cnblogs.com'; Execute; Free; end; end;
关联 TBrowseURL 到 TSpeedButton:
uses ExtActns, Buttons; var bUrl: TBrowseURL; sBtn: TSpeedButton; procedure TForm1.FormCreate(Sender: TObject); begin bUrl := TBrowseURL.Create(Self); bUrl.URL := 'http://del.cnblogs.com'; bUrl.Caption := 'Open URL'; sBtn := TSpeedButton.Create(Self); sBtn.Parent := Self; sBtn.Width := 100; sBtn.Action := bUrl; end;
使用 TDownLoadURL 下载文件:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtActns, ComCtrls; type TForm1 = class(TForm) Button1: TButton; ProgressBar1: TProgressBar; procedure Button1Click(Sender: TObject); private procedure DownProgress(Sender: TDownLoadURL; Progress, ProgressMax: Cardinal; StatusCode: TURLDownloadStatus; StatusText: String; var Cancel: Boolean); public end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin Button1.Enabled := False; with TDownLoadURL.Create(nil) do begin URL := 'http://files.cnblogs.com/del/PMark_1.rar'; Filename := 'c:\temp\PMark_1.rar'; OnDownloadProgress := DownProgress; //下载进度 ExecuteTarget(nil); Free; end; Button1.Enabled := True; end; procedure TForm1.DownProgress(Sender: TDownLoadURL; Progress, ProgressMax: Cardinal; StatusCode: TURLDownloadStatus; StatusText: String; var Cancel: Boolean); begin ProgressBar1.Max := ProgressMax; ProgressBar1.Position := Progress; Application.ProcessMessages; end; end.