spellersreg.pas

来自「拼写检查」· PAS 代码 · 共 54 行

PAS
54
字号
unit SpellersReg;

interface

uses
{$IFDEF VER130} { Borland Delphi 5.x }
  DsgnIntf;
{$ELSE}
  DesignIntf, DesignEditors;
{$ENDIF}

procedure Register;

implementation

uses
  Dialogs, Windows, Forms, Classes, SysUtils, Spellers, Langs, LangsReg;

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

procedure TDictFileProperty.Edit;
var
  FileOpen: TOpenDialog;
begin
  FileOpen := TOpenDialog.Create(Application);
  FileOpen.Filename := GetValue;
  FileOpen.Filter := 'Dictionary files (*.dic)|*.dic|All files (*.*)|*.*';
  FileOpen.Options := FileOpen.Options + [ofShowHelp, ofPathMustExist,
    ofFileMustExist];
  try
    if FileOpen.Execute then SetValue(FileOpen.Filename);
  finally
    FileOpen.Free;
  end;
end;

function TDictFileProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paRevertable];
end;

procedure Register;
begin
  RegisterComponents('LS', [TSpellChecker]);
  RegisterPropertyEditor(TypeInfo(TFileName), TSpellChecker, 'CustomDict', TDictFileProperty);
end;

end.

⌨️ 快捷键说明

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