delphi.gif (306 バイト) VSSpellの使い方


VSSpellはスペルチェックをするActiveXコントロールで、アプリケーションに簡単にスペルチェックの機能を追加することができます。日本語(全角)では無効ですが、けっこう面白いコンポーネントです。

 

toach.gif (917 バイト) VSSpellの簡単な使い方

  1. オブジェクトインスペクタでオプションを設定します。ふつうはデフォルトのままでOKです。
  2. プログラム例を以下に示します。この例ではMemoコンポーネントのテキストをチェックしてユーザが訂正した通りにMemoのテキストを更新します。

// スペルチェック開始
procedure TForm1.Button1Click(Sender: TObject);
begin
    curline := 0;
    while curline > Memo1.Lines.Count do
    begin
      VSSpell1.CheckText := Memo1.Lines[curline];
      Inc(curline);
    end;
end;


// スペルチェックが終わったとき
procedure TForm1.VSSpell1Complete(Sender: TObject;
  var EventAction: Smallint);
var
  str: string;
  i, l: Integer;
begin
  str := VSSpell1.Text;
  i := VSSpell1.WordOffset;
  l := Length(VSSpell1.MisspelledWord);
  Memo1.Lines[curline] := str;
end;

toach.gif (917 バイト) VSSpellのヘルプ

\Delphi3\Ocx\Vci\Vspel\Vsocx.hlpです。l