mcpField
S
syncfusion-winforms-spell-checker

syncfusion-winforms-spell-checker

github.com/syncfusion開発283 回インストール2 週間前に更新
リポジトリ

syncfusion-winforms-spell-checker について

Windows Forms のテキストコントロールに Syncfusion SpellCheckerAdv を追加するためのガイドです。辞書、言語切り替え、コンテキストメニューでのチェック、候補表示を扱います。

主な機能

  1. 01TextBox と RichTextBox のチェック
  2. 02Hunspell、Ispell、OpenOffice 辞書
  3. 03実行時のカルチャ切り替え
  4. 04コンテキストメニューの候補
  5. 05除外ルールと修正候補

活用シーン

  1. 01メールクライアントへのチェック追加
  2. 02エディター内の多言語テキスト確認
  3. 03フォーム入力の検証
  4. 04URL とメールアドレスの除外

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/syncfusion/winforms-ui-components-skills --skill syncfusion-winforms-spell-checker

インストール後、Claude Code で/syncfusion-winforms-spell-checkerを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
context-menu-integration.md
customization-suggestions.md
dictionary-setup.md
getting-started.md

詳細

Syncfusion Windows Forms SpellChecker の実装

SpellCheckerAdv コントロールは、Windows Forms のテキストコントロールに Microsoft Office スタイルのスペルチェック機能を提供します。このスキルでは、インストール、コントロールの関連付け、辞書の設定、コンテキストメニューとの統合、カスタマイズオプションについて説明します。

このスキルを使用する場合

次のような場合に、このスキルを使用してください。

  • RichTextBox または TextBox コントロールにスペルチェックを追加する
  • 辞書ソース(組み込みの英語辞書またはカスタム辞書)を設定する
  • コンテキストメニューからスペルチェックを実行できるようにする
  • 特殊な内容(メールアドレス、URL、数字)の無視ルールをカスタマイズする
  • スペル候補や代替候補を取得する
  • 異なる辞書形式を使用して複数の言語に対応する

ドキュメントの案内

はじめに

📄 参照: references/getting-started.md

  • インストールとアセンブリ参照
  • デザイナーまたはコードからコントロールを追加する
  • SpellCheckerAdv をテキストコントロールとともに設定する
  • スペルチェック操作を実行する
  • 基本的な実装パターン
辞書の設定

📄 参照: references/dictionary-setup.md

  • 既定の英語辞書を設定する
  • 複数の言語に対応する Hunspell 辞書を追加する
  • Ispell 辞書を追加する
  • OpenOffice 辞書を追加する
  • 実行時にカルチャを切り替える
  • カスタム辞書のサポート
コンテキストメニューとの統合

📄 参照: references/context-menu-integration.md

  • ISpellCheckerAdvEditorTools インターフェイスを実装する
  • TextBoxSpellEditor ラッパークラスを作成する
  • 実行時のコンテキストメニューを設定する
  • ユーザー操作によるスペルチェックのワークフロー
  • コンテキストメニューから辞書に追加する
カスタマイズと候補

📄 参照: references/customization-suggestions.md

  • 無視オプション(メールアドレス、URL、大文字と小文字の混在、特殊記号)
  • 候補リストを取得する
  • 発音に基づく単語の代替候補
  • アナグラムの候補
  • カスタム単語の管理

クイックスタートの例

基本的なスペルチェックの設定:

using Syncfusion.Windows.Forms.Tools;

// 1. Create SpellCheckerAdv control
SpellCheckerAdv spellCheckerAdv = new SpellCheckerAdv();

// 2. Set dictionary path
spellCheckerAdv.DictionaryPath = "Syncfusion_en_us.dic";

// 3. Attach to RichTextBox and trigger spell check
RichTextBox richTextBox = new RichTextBox();
spellCheckerAdv.SpellCheck(new SpellCheckerAdvEditorWrapper(richTextBox));

コンテキストメニューでのスペルチェック:

// Implement ISpellCheckerAdvEditorTools
class TextBoxSpellEditor : ISpellCheckerAdvEditorTools
{
    private TextBoxBase textBox;
    
    public TextBoxSpellEditor(Control control)
    {
        Control = control;
    }
    
    public Control Control 
    { 
        get { return textBox; }
        set { textBox = value as TextBoxBase; }
    }
    
    public string Text
    {
        get { return textBox.Text; }
        set { textBox.Text = value; }
    }
    
    public string CurrentWord { get; set; }
    
    public void SelectText(int start, int length)
    {
        textBox.Select(start, length);
    }
}

// Enable context menu spell checking
TextBoxSpellEditor editor = new TextBoxSpellEditor(richTextBox);
spellCheckerAdv.PerformSpellCheckUsingContextMenu(editor);

よく使われる実装パターン

パターン 1: ダイアログベースのスペルチェック

ユーザーが「スペルチェック」ボタンをクリック → SpellCheckerAdv ダイアログが開く → ユーザーがスペルミスのある単語を確認して修正する → ダイアログが閉じる。

private void buttonSpellCheck_Click(object sender, EventArgs e)
{
    spellCheckerAdv.SpellCheck(new SpellCheckerAdvEditorWrapper(richTextBox));
}
パターン 2: リアルタイムのコンテキストメニュー

ユーザーがスペルミスのある単語を右クリック → 候補を含むコンテキストメニューが表示される → ユーザーが修正候補を選択するか、辞書に追加する。

TextBoxSpellEditor editor = new TextBoxSpellEditor(richTextBox);
spellCheckerAdv.PerformSpellCheckUsingContextMenu(editor);
パターン 3: 複数言語への対応

複数の辞書カルチャを設定し、ユーザーの設定またはコンテンツの言語に応じて実行時に切り替えます。

SpellCheckerAdv spellChecker = new SpellCheckerAdv();
spellChecker.Dictionaries = new DictionaryCollection();

// Add English dictionary
spellChecker.Dictionaries.Add(new HunspellDictionary()
{
    Culture = new CultureInfo("en-US"),
    DictionaryPath = @"en-US.dic",
    GrammarPath = @"en-US.aff"
});

// Add French dictionary
spellChecker.Dictionaries.Add(new HunspellDictionary()
{
    Culture = new CultureInfo("fr-FR"),
    DictionaryPath = @"fr-FR.dic",
    GrammarPath = @"fr-FR.aff"
});

// Switch to French at runtime
spellChecker.Culture = new CultureInfo("fr-FR");

主なプロパティとメソッド

要素目的使用する場面
DictionaryPath組み込み辞書の場所を設定するシンプルな英語のスペルチェック
Dictionariesカスタム辞書(Hunspell、Ispell、OpenOffice)を追加する複数言語への対応
Cultureアクティブなスペルチェック言語を設定する言語の切り替え
SpellCheck()スペルチェックダイアログを起動するユーザーが開始するスペルチェック
PerformSpellCheckUsingContextMenu()コンテキストメニューの候補を有効にするリアルタイムのスペルチェック
GetSuggestions()修正候補を取得するプログラムによるスペルチェック
IgnoreEmailAddress、IgnoreUrl など特殊な内容の種類をスキップするカスタマイズしたスペルチェック

よくあるユースケース

  1. メールクライアント: カスタム辞書を使用した右クリックによるスペルチェック
  2. ドキュメントエディター: コンテキストメニューを使った複数言語のスペルチェック
  3. フォームの検証: 送信前にユーザー入力をチェックする
  4. コンテンツ管理: コンテンツ内の URL とメールアドレスを無視する
  5. 多言語アプリ: UI カルチャに応じてスペルチェック言語を切り替える

コメント