随笔 - 2146  文章 - 19 评论 - 11846 阅读 - 1267万


TAction //<- TCustomAction <- TContainedAction <- TBasicAction <- TComponent

TActionList //<- TCustomActionList <- TComponent
//其父类 TCustomActionList 包含一个 TContainedAction 类型的动作列表(Actions[])

TActionManager //<- TCustomActionManager <- TCustomActionList <- TComponent)
//其父父类 TCustomActionList 包含一个 TContainedAction 类型的动作列表(Actions[])

TCustomizeDlg //<- TComponent
//它拥有 ActionManager: TCustomActionManager 属性

TActionToolBar //<- TCustomActionToolBar <- TCustomActionDockBar <- TCustomActionBar <- TToolWindow <<<- TComponent
//其父父父类 TCustomActionBar 拥有 ActionManager: TCustomActionManager 属性.

TActionMainMenuBar //<- TCustomActionMainMenuBar <- TCustomActionMenuBar <- TCustomActionDockBar <- TCustomActionBar <- TToolWindow <<<- TComponent
//其父父父父类 TCustomActionBar 拥有 ActionManager: TCustomActionManager 属性.

TMenuItem //<- TComponent
//它拥有 Action: TBasicAction 属性

TPopupActionBar //<- TPopupMenu <- TMenu <- TComponent
//它内部拥有 FActionManager: TCustomActionManager 成员


{ StdActns 单元一些更具体的类: }

THintAction   //<- TCustomAction <- TContainedAction <- TBasicAction <- TComponent

TEditAction   //<- TAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TEditAction -> TEditCut、TEditCopy、TEditPaste、TEditSelectAll、TEditUndo、TEditDelete、TEditSelectAll、TEditSelectAll

TWindowAction //<- TAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TWindowAction -> TWindowClose、TWindowCascade、TWindowTileHorizontal、TWindowTileVertical、TWindowMinimizeAll、TWindowArrange

THelpAction   //<- TAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
THelpAction -> THelpContents、THelpTopicSearch、THelpOnHelp、THelpContextAction

TFileAction   //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TFileAction -> TFileOpenWith、TFileSaveAs、TFilePrintSetup、TFilePageSetup、TFileExit

TSearchFind      //<- TSearchAction <- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TSearchReplace   //<- TSearchAction <- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TSearchFindFirst //<- TSearchFind <- TSearchAction <- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TSearchFindNext  //<- TCustomAction <- TContainedAction <- TBasicAction <- TComponent

TFontEdit        //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TColorSelect     //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TPrintDlg        //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent
TBrowseForFolder //<- TCommonDialogAction <- TCustomAction <- TContainedAction <- TBasicAction <- TComponent


{ 另有 ExtActns 单元下的: }
TFileRun、TRichEditAction、TRichEditBold、TRichEditItalic、TRichEditUnderline、TRichEditStrikeOut、TRichEditStrikeOut、
TRichEditBullets、TRichEditAlignLeft、TRichEditAlignRight、TRichEditAlignCenter、TTabAction、TPreviousTab、TNextTab、
TOpenPicture、TSavePicture、TURLAction、TBrowseURL、TDownLoadURL、TSendMail

{ DBActns 单元下的: }
TDataSetAction、TDataSetFirst、TDataSetPrior、TDataSetNext、TDataSetLast、TDataSetInsert、
TDataSetDelete、TDataSetEdit、TDataSetPost、TDataSetCancel、TDataSetRefresh

{ ActnRes 单元下的: }
TStandardActions

//它们一般用在窗体设计时


使用 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 := 'https://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.

posted on   万一  阅读(3313)  评论(3编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
历史上的今天:
2008-05-09 获取变量类型的函数
2008-05-09 内存管理[5]
2008-05-09 内存管理[4]


点击右上角即可分享
微信分享提示