WPF uses HunSpell wrapper class NHunspellWrapper.
private void Window_Loaded (object sender, RoutedEventArgse)
{
// spelling check
varhunspell=new NHunspellWrapper();
}
Called by
publicNHunspellWrapper(): this("en_US.aff", "en_US.dic", null, new SpellingFormBasic())
{
}
/// <param name="affFile">"en_us.aff"</param>
/// <param name="dicFile">"en_us.dic"</param>
public NHunspellWrapper(string affFile, stringdicFile, ISpellingControl textEditor, ISpellingWindowspellForm)
{
try
{
hunspell=new Hunspell(affFile,dicFile);
varchk=hunspell.Spell("with");<-false returns
:
Hunspell is not null, but I feel like I can't read the dictionary file or initialization has failed.
There's no basis, but...
I couldn't find this sample of Hunspell when I looked for something like WinForm and WPF.
It seems that the HunspellWrapper component spellingWorker is made in WinForm, but not in WPF.
How do I use Hunspell components in WPF?
Environment Windows 10 VS 2015 C#WPF
c# wpf
Why not replace it with NHunspellSpellcheck-Hyphen-Thesaurus standard SpellCheck
It seems that this will work.
From the above site
using(var hunspell=new Hunspell("en_us.aff", "en_us.dic")))
{
string [ ] lines = System.IO.File.ReadAllLines("CustomWords-en_US.txt");
foreach (var line in lines)
{
hunspell.Add(line);
}
It seems to work in the form of the directly.
Thank you.
© 2024 OneMinuteCode. All rights reserved.