なぜSyncfusion Winformsスペルチェッカーをテキストエディターに統合する必要がありますか?
26217 ワード
統合WinForms Spell Checker ( SpellCheckReadV )を使用して、WinFormsアプリケーションのテキストのスペルをチェックします.それはテキストのスペルミスを識別し、それらを修正するWinFormsテキストエディタと統合することができます.コントロールは、特別な単語を無視することができます辞書に新しい用語を追加し、スペルをチェックするカスタム辞書を使用します.
テキストエディターコントロールは、テキストの編集、コンテンツの書式設定、テキストの検索および置換に使用されます.
テキストエディタコントロールでSyncFusion Winformsスペルチェッカーを統合するにはどうしたらよいでしょうか?
このスペルチェッカーを使えば、
Load your own dictionaries for any language ( Hunspell , Ispell , OpenOfficeなど).
Switch among different cultures at runtime .
Get suggestions for fixing errors .
Ignore special expressions .
Apply different visual styles . WinFormsスペルチェッカーを統合することで、これらの機能をTextBoxコントロールで使用してみましょう.
TextBoxコントロール内でスペルチェッカーを設定する手順に従います
ステップ1 :プロジェクトを作成する
Visual Studioで新しいWindowsフォームプロジェクトを作成します.
ステップ2 :手動でコードを使用してコントロールを追加します.
手動でCを押すと以下のようになります. 次の必要なアセンブリ参照をプロジェクトに追加します. syncfusionツールベース.DLL syncfusionツールWindowsDLL syncfusion共用.ベース.DLL syncfusion共用.WindowsDLL syncfusionスペルチェックベース.DLL syncfusionグリッド.ベース.DLL syncfusionグリッド.WindowsDLL 名前空間syncfusionを含める**Windowsフォーム.ツール**.
コントロールのインスタンスを作成します.
WINFORMプロジェクトでは、ISpellCheckerAdvEditorTools インターフェイス.
RichTextBoxのインスタンスを作成し、追加します.
RichTextBoxインスタンスをコンストラクターに渡し、TextBoxSpellletorクラスのインスタンスを作成します.を使用してspellcheckeradvに追加しますPerformSpellCheckForControl メソッド.
最後に、ボタンのClickイベントを通じてSpellCheckAdadVをトリガーします.
Winterスペルチェッカーによるテキストエディタコントロール
あなた自身の辞書を追加することができますSpellCheckerAdv.Dictionaries コレクション.
次の標準的な辞書ファイル形式をサポートします. 呪文 Ispell OpenOffice
次のファイルを含むhunspell辞書形式を使用してスペルミスをチェックできます. ファイルのルールを添付します.aff 基本単語ファイル*.ディックファイル 加えるあなたHunspellDictionary ’必要なカルチャーファイル*.AFFと*.アプリケーションへのリソースとしてのDIC.我々は、フランスの文化のためのhunspell辞書を追加する予定です.
次のスクリーンショットを参照してください.
HunspellDictionaryのインスタンスを作成し、基本的な単語と文法ファイルのパスをHunspellDictionary.DictionaryPath and HunspellDictionary.GrammarPath
プロパティを追加し、HunspellDictionary.Culture プロパティ. にhunspelldictionaryを追加しますSpellCheckerAdv.Dictionaries コレクション. 必要なカルチャをspellcheckeradvに設定します.文化財.
次のコード例を参照してください.
あなたはSpellCheckAdadVにHunspell、Ispell、またはOpenOfficeの辞書の任意の数を追加することができます.辞書コレクション.
スペルチェッカキーを変更することで、実行時にスペルチェッカーの文化を変更することができます.文化財.
SpellCheckAdadVの値に基づきます.文化、セット辞書スペルチェックに使用されます.次のコードを参照してください.
スペルチェッカーは、これらのメソッドでエラーワードを渡すことによって関連する単語のリストを提案します. GetSuggestions GetPhoneticWords GetAnagrams 次のコードを参照してください.
スペルチェッカーは、オプションのエラーリストに入力テキストからスペルミスの単語を追加することができます.また、あなたはメールID、HTMLタグ、英数字などのような特別な式のスペルチェックを無視することができます.
次のコード例を参照してください.
次のスクリーンショットを参照してください.
スペルチェッカーは次のテーマをサポートしています. デフォルト メトロ オフィス オフィス2016ホワイト オフィス オフィス2016ブラック 次のコード例では、VisualStyle スペルチェッカー用.
これを参照して別のテーマのビジュアルスタイルを設定できますdocumentation ページ.
追加の利点についての明確なアイデアがあることを願っていますWinForms Spell Checker テキストエディターコントロールに.これらの機能を使用すると、動的に任意の言語や文化のスペルをチェックすることができます、提案を得る、特別な式を無視し、美しい視覚的なスタイルを追加します.だから、それらを試してみて、以下のフィードバックセクションでコメントを残してください.
既存の顧客のために、重要なStudioの最新版は、ダウンロードから入手可能ですLicense and Downloads ページ.まだSyncFusionの顧客でない場合は、私たちの30日を試すことができますfree trial 当社の利用可能な機能をチェックアウトします.また、このサンプルを試してGitHub ロケーション.
また、我々を介してお問い合わせすることができますsupport forum , Direct-Trac , or feedback portal . 我々は常にあなたを支援して満足している!
テキストエディターコントロールは、テキストの編集、コンテンツの書式設定、テキストの検索および置換に使用されます.
テキストエディタコントロールでSyncFusion Winformsスペルチェッカーを統合するにはどうしたらよいでしょうか?
このスペルチェッカーを使えば、
Load your own dictionaries for any language ( Hunspell , Ispell , OpenOfficeなど).
Switch among different cultures at runtime .
Get suggestions for fixing errors .
Ignore special expressions .
Apply different visual styles .
テキストボックスコントロールでのSpellCheckadadvの設定
TextBoxコントロール内でスペルチェッカーを設定する手順に従います
ステップ1 :プロジェクトを作成する
Visual Studioで新しいWindowsフォームプロジェクトを作成します.
ステップ2 :手動でコードを使用してコントロールを追加します.
手動でCを押すと以下のようになります.
using Syncfusion.Windows.Forms.Tools;
SpellCheckerAdv spellCheckerAdv1 = new SpellCheckerAdv();
ステップ3 :テキストボックスのスペルチェックキーを設定します.class TextBoxSpellEditor : ISpellCheckerAdvEditorTools
{
/// <summary>
/// Initializes the TextBoxBase control.
/// </summary>
private TextBoxBase textBox;
/// <summary>
/// Initializes the new instance of the TextBoxSpellEditor class.
/// </summary>
/// <param name="control"></param>
public TextBoxSpellEditor(Control control)
{
Control = control;
}
/// <summary>
/// Gets or sets the control whose text is to be spell checked.
/// </summary>
public Control Control
{
get
{
return textBox;
}
set
{
textBox = value as TextBoxBase;
}
}
/// <summary>
/// Gets or sets the current misspelled word.
/// </summary>
public string CurrentWord
{
get
{
return textBox.Text;
}
set
{
textBox.Text = value;
}
}
/// <summary>
/// Gets or sets the text to be spell checked by the <see cref="SpellCheckerAdv"/>
/// </summary>
public string Text
{
get
{
return textBox.Text;
}
set
{
textBox.Text = value;
}
}
/// <summary>
/// Gets or sets the control whose text is to be spell checked.
/// </summary>
public Control ControlToCheck
{
get
{
return textBox;
}
set
{
textBox = value as TextBoxBase;
}
}
/// <summary>
/// Selects the word specified by the index.
/// </summary>
/// <param name="selectionStart">Zero based index of the word in the text.</param>
/// <param name="selectionLength">length of the word to be selected.</param>
public void SelectText(int selectionStart, int selectionLength)
{
textBox.Select(selectionStart, selectionLength);
}
}
RichTextBox richTextBox1 = new RichTextBox();
Button button1 = new Button();
this.richTextBox1.Text = resources.GetString("richTextBox1.Text");
this.button1.Text="Spell Check";
this.Controls.Add(this.button1);
this.Controls.Add(this.richTextBox1);
TextBoxSpellEditor TextEditor = new TextBoxSpellEditor(this.richTextBox1);
this.spellCheckerAdv1.PerformSpellCheckForControl(TextEditor);
private void buttonAdv1_Click(object sender, EventArgs e)
{
this.spellCheckerAdv1.SpellCheck(new SpellCheckerAdvEditorWrapper(this.richTextBox1));
}
プロジェクトを実行すると次のスクリーンショットのように出力されます.Winterスペルチェッカーによるテキストエディタコントロール
任意の言語のロード独自の辞書
あなた自身の辞書を追加することができますSpellCheckerAdv.Dictionaries コレクション.
次の標準的な辞書ファイル形式をサポートします.
hunspell辞書を使用したスペルチェック
次のファイルを含むhunspell辞書形式を使用してスペルミスをチェックできます.
hunspell辞書の追加
次のスクリーンショットを参照してください.
プロパティを追加し、HunspellDictionary.Culture プロパティ.
次のコード例を参照してください.
//Creating a culture instance.
CultureInfo culture = new CultureInfo("fr-FR");
SpellCheckerAdv SpellChecker = new SpellCheckerAdv();
// Adding Hunspell dictionaries in Dictionaries collection.
SpellChecker.Dictionaries = new DictionaryCollection();
//Adding French culture Hunspell dictionary.
SpellChecker.Dictionaries.Add(
new HunspellDictionary()
{
Culture = culture, GrammarPath = @"\FrenchDictionary\french.aff",
DictionaryPath = @"\FrenchDictionary\french.dic"
}
);
//Setting French culture for SpellChecker.
SpellChecker.Culture = culture;
同様に、IspellとOpenOffice辞書のためのカルチャを追加して設定することができますdocumentation .ランタイムで言語を切り替える
あなたはSpellCheckAdadVにHunspell、Ispell、またはOpenOfficeの辞書の任意の数を追加することができます.辞書コレクション.
スペルチェッカキーを変更することで、実行時にスペルチェッカーの文化を変更することができます.文化財.
SpellCheckAdadVの値に基づきます.文化、セット辞書スペルチェックに使用されます.次のコードを参照してください.
//Creating a culture instance.
CultureInfo culture = new CultureInfo("fr-FR");
SpellCheckerAdv SpellChecker = new SpellCheckerAdv();
// Adding Hunspell dictionaries in Dictionaries collection.
SpellChecker.Dictionaries = new DictionaryCollection();
//Add French culture Hunspell dictionary.
SpellChecker.Dictionaries.Add(
new HunspellDictionary()
{
Culture = culture,
GrammarPath = @"\FrenchDictionary\fr-FR.aff",
DictionaryPath = @"\FrenchDictionary\fr-FR.dic"
}
);
//Add Spanish culture Hunspell dictionary.
SpellChecker.Dictionaries.Add(
new HunspellDictionary()
{
Culture = new CultureInfo("es-ES"),
GrammarPath = @"\SpanishDictionary\es-ES.aff",
DictionaryPath = @"\SpanishDictionary\es-ES.dic"
}
);
//Add US culture Hunspell dictionary.
SpellChecker.Dictionaries.Add( new HunspellDictionary()
{
Culture = new CultureInfo("en-US"),
GrammarPath = @"\USDictionary\en-US.aff",
DictionaryPath = @"\USDictionary\/en-US.dic"
}
);
//Setting French culture for SpellChecker.
SpellChecker.Culture = culture;
ここでは、スペルチェッカー.文化はfr frにセットされます.そこで、FR FRカルチャー用の辞書をスペルチェック辞書として使用します.エラーの単語を修正するための提案を得る
スペルチェッカーは、これらのメソッドでエラーワードを渡すことによって関連する単語のリストを提案します.
this.spellCheckerAdv1.GetSuggestions("Textboxx");
this.spellCheckerAdv1.GetPhoneticWords("Textboxx");
this.spellCheckerAdv1.GetAnagrams("Textbox");
特殊表現を無視する
スペルチェッカーは、オプションのエラーリストに入力テキストからスペルミスの単語を追加することができます.また、あなたはメールID、HTMLタグ、英数字などのような特別な式のスペルチェックを無視することができます.
次のコード例を参照してください.
SpellCheckerAdv checker = new SpellCheckerAdv();
checker.IgnoreEmailAddress = true;
checker.IgnoreFileNames = true;
checker.IgnoreHtmlTags = true;
checker.IgnoreUrl = true;
checker.IgnoreSpecialSymbols = true;
checker.IgnoreMixedCaseWords = true;
checker.IgnoreUpperCaseWords = true;
checker.IgnoreAlphaNumericWords = true;
これらのオプションは、スペルチェッカーオプションダイアログを介して実行時にアクセスできます.これは、SpellCheckerダイアログで利用できるOptionsボタンを使用することで起動できます.次のスクリーンショットを参照してください.
ビジュアルスタイルの設定
スペルチェッカーは次のテーマをサポートしています.
this.spellCheckerAdv1.VisualStyle = Syncfusion.Windows.Forms.Tools.SpellCheckerAdvStyle.Office2016Black;
オフィス2016ブラックこれを参照して別のテーマのビジュアルスタイルを設定できますdocumentation ページ.
結論
追加の利点についての明確なアイデアがあることを願っていますWinForms Spell Checker テキストエディターコントロールに.これらの機能を使用すると、動的に任意の言語や文化のスペルをチェックすることができます、提案を得る、特別な式を無視し、美しい視覚的なスタイルを追加します.だから、それらを試してみて、以下のフィードバックセクションでコメントを残してください.
既存の顧客のために、重要なStudioの最新版は、ダウンロードから入手可能ですLicense and Downloads ページ.まだSyncFusionの顧客でない場合は、私たちの30日を試すことができますfree trial 当社の利用可能な機能をチェックアウトします.また、このサンプルを試してGitHub ロケーション.
また、我々を介してお問い合わせすることができますsupport forum , Direct-Trac , or feedback portal . 我々は常にあなたを支援して満足している!
Reference
この問題について(なぜSyncfusion Winformsスペルチェッカーをテキストエディターに統合する必要がありますか?), 我々は、より多くの情報をここで見つけました https://dev.to/syncfusion/why-should-you-integrate-syncfusion-winforms-spell-checker-into-your-text-editor-2akmテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol