• Action 相关组件



    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.
    

  • 相关阅读:
    js,jQuery实现可关闭悬浮框广告特效,兼容(谷歌,火狐,Ie)
    各种选择框jQuery的选中方法
    表单校验demo
    两种方法实现城市级联菜单
    树形菜单
    匿名函数和鼠标移入移除事件
    多线程实例
    Lock锁
    Oracle语句
    Java NIO
  • 原文地址:https://www.cnblogs.com/del/p/2041290.html
Copyright © 2020-2023  润新知