⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgspellcheck.pas

📁 Delphi编写的一个支持语法高亮显示和很多语言的文本编辑器
💻 PAS
字号:
unit dlgSpellCheck;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, CorelButton;

type
  TSpellCheckDialog = class(TForm)
    txtNotFound: TEdit;
    Label1: TLabel;
    txtChangeTo: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    btnChange: TCorelButton;
    btnIgnore: TCorelButton;
    btnIgnoreAll: TCorelButton;
    btnAdd: TCorelButton;
    btnClose: TCorelButton;
    lstSuggestions: TListBox;
    procedure lstSuggestionsClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure PrepareShow(AEditorRect: TRect;
      X, Y1, Y2: integer);
  end;

var
  SpellCheckDialog: TSpellCheckDialog;

implementation

{$R *.DFM}

uses
  uOptVars;
  
procedure TSpellCheckDialog.lstSuggestionsClick(Sender: TObject);
begin
  txtChangeTo.Text := lstSuggestions.Items[lstSuggestions.ItemIndex];
end;

procedure TSpellCheckDialog.FormShow(Sender: TObject);
begin
  if lstSuggestions.Items.Count = 0 then begin
    lstSuggestions.Items.Add(SSpellNoSugg);
    lstSuggestions.Enabled := false;
    txtChangeTo.Text := txtNotFound.Text;
  end else begin
    lstSuggestions.Enabled := true;
    lstSuggestions.ItemIndex := 0;
    txtChangeTo.Text := lstSuggestions.Items[0];
  end;
end;

procedure TSpellCheckDialog.PrepareShow(AEditorRect: TRect;
  X, Y1, Y2: integer);
var
  nW, nH: integer;
begin
  nW := AEditorRect.Right - AEditorRect.Left;
  nH := AEditorRect.Bottom - AEditorRect.Top;

  if nW <= Width then
    X := AEditorRect.Left - (Width - nW) div 2
  else begin
    if X + Width > AEditorRect.Right then
      X := AEditorRect.Right - Width;
  end;
  if Y2 > AEditorRect.Top + MulDiv(nH, 2, 3) then
    Y2 := Y1 - Height - 4
  else
    Inc(Y2, 4);
  SetBounds(X, Y2, Width, Height);
end;

procedure TSpellCheckDialog.FormDestroy(Sender: TObject);
begin
  SpellCheckDialog := nil;
end;

end.

⌨️ 快捷键说明

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