cvreg.pas

来自「一个窗口控制TCursorView显示静态或动画的游标在一种形式。控制使用标准的」· PAS 代码 · 共 71 行

PAS
71
字号
{------------------------------------------------------------------------------}
{                                                                              }
{  TCursorView v1.02                                                           }
{  by Kambiz R. Khojasteh                                                      }
{                                                                              }
{  kambiz@delphiarea.com                                                       }
{  http://www.delphiarea.com                                                   }
{                                                                              }
{------------------------------------------------------------------------------}

{$I DELPHIAREA.INC}

unit CVReg;

interface

uses
  Windows, Classes,
  {$IFDEF COMPILER6_UP} DesignIntf, DesignEditors {$ELSE} DsgnIntf {$ENDIF};

type

{ TWavePropertyEditor }

  TCursorFilePropertyEditor = class(TStringProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;

procedure Register;

implementation

uses
  CursorView, Dialogs, SysUtils;

{ TCursorFilePropertyEditor }

function TCursorFilePropertyEditor.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paMultiSelect];
end;

procedure TCursorFilePropertyEditor.Edit;
var
  I: Integer;
begin
  with TOpenDialog.Create(nil) do
    try
      Filter := 'Cursor files (*.cur;*.ani)|*.cur;*.ani|Any file (*.*)|*.*';
      Options := Options + [ofPathMustExist, ofFileMustExist];
      if Execute then
      begin
        for I := 0 to PropCount - 1 do
          TCursorView(GetComponent(I)).FileName := FileName;
        Modified;
      end;
    finally
      Free;
    end
end;

procedure Register;
begin
  RegisterComponents('Delphi Area', [TCursorView]);
  RegisterPropertyEditor(TypeInfo(TFileName), TCustomCursorView, 'FileName', TCursorFilePropertyEditor);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?