65.9K
CodeProject 正在变化。 阅读更多。
Home

i00 拼写检查和控件扩展 - 无需第三方组件!

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.95/5 (114投票s)

2011 年 10 月 9 日

Ms-PL

16分钟阅读

viewsIcon

1688288

downloadIcon

23

.NET 的易于使用的开源拼写检查器

任何希望在其项目中使用此代码的人都可以这样做,但要求在此页面上发帖说明他们正在使用此代码。
一个简单的“我在项目中使用 i00 拼写检查”就足够了。

引言

我想要一个可以在 .NET 中使用的拼写检查器,所以像大多数人会做的那样,我谷歌了一下。经过数小时无果的搜索,我决定自己做一个;当然,市面上有许多拼写检查器,但我不想使用依赖于 Word 等第三方组件或需要互联网连接才能工作的拼写检查器。隆重推出 i00 .NET Spell Check,第一个也是唯一一个完全用 VB 编写的 VB.NET 拼写检查器!不仅如此,它还是开源的,而且易于使用。

最终,该项目进一步发展成为一个通用的控件扩展插件,提供文本框打印、翻译、语音识别和听写等插件;同时还为用户提供了一个编写自己的扩展的简单方法。

屏幕截图

带释义的拼写检查

菜单中的单词释义和“更改为...”

将单词添加到字典

自定义内容菜单

填字游戏生成器

选项

Owner draw 和 RTB 支持

拼写检查对话框

支持 DataGridViews!

插件支持...带 Label 插件

插件支持...带 FastColoredTextBox 插件

实现

要将 i00 .NET Spell Check 实现到您的项目中,首先,要么

  • 将 `i00SpellCheck` 项目添加到您的解决方案并引用它(推荐)
  • 引用此项目输出的 `i00SpellCheck.exe` 文件*
  • 或者您可以将“SpellCheck\Spell Check”文件夹(来自 zip)中的所有 `*.vb` 文件直接引入您自己的项目(仅限 VB.Net)*

注意:对于带 * 的方法,您还需要将字典文件复制到应用程序路径。

接下来,只需将此放在您的窗体顶部即可

Imports SpellCheck.i00SpellCheck
using i00SpellCheck;

 

现在您将能够通过以下方式启用控件扩展

Me.EnableControlExtensions()
this.EnableControlExtensions(null);

上面的行将启用窗体上所有受支持控件以及所有拥有的已打开窗体的控件扩展。

 

下面是一些其他示例

'To load a single control extension on a control call: 
ControlExtensions.LoadSingleControlExtension(TextBox1, New TextBoxPrinter.TextBoxPrinter)

'To enable spell check on single line textboxes you will need to call:
TextBox1.EnableSpellCheck()

'If you wanted to pass in options you can do so by handling the ControlExtensionAdding event PRIOR to calling EnableControlExtensions:
AddHandler ControlExtensions.ControlExtensionAdding, AddressOf ControlExtensionAdding
'Also refer to the commented ControlExtensionAdding Sub in this form for more info

'You can also enable spell checking on an individual Control (if supported):
TextBox1.EnableSpellCheck()

'To disable the spell check on a Control:
TextBox1.DisableSpellCheck()

'To see if the spell check is enabled on a Control:
Dim SpellCheckEnabled = TextBox1.IsSpellCheckEnabled()
'To see if another control extension is loaded (in this case call see if the TextBoxPrinter Extension is loaded on TextBox1):
Dim PrinterExtLoaded = TextBox1.ExtensionCast(Of TextBoxPrinter.TextBoxPrinter)() IsNot Nothing

'To change spelling options on an individual Control:
TextBox1.SpellCheck.Settings.AllowAdditions = True
TextBox1.SpellCheck.Settings.AllowIgnore = True
TextBox1.SpellCheck.Settings.AllowRemovals = True
TextBox1.SpellCheck.Settings.ShowMistakes = True
'etc

'To set control extension options / call methods from control extensions (in this case call Print() from TextBox1):
Dim PrinterExt = TextBox1.ExtensionCast(Of TextBoxPrinter.TextBoxPrinter)()
PrinterExt.Print()

'To show a spellcheck dialog for an individual Control:
Dim iSpellCheckDialog = TryCast(TextBox1.SpellCheck, i00SpellCheck.SpellCheckControlBase.iSpellCheckDialog)
If iSpellCheckDialog IsNot Nothing Then
    iSpellCheckDialog.ShowDialog()
End If

'To load a custom dictionary from a saved file:
Dim Dictionary = New i00SpellCheck.FlatFileDictionary("c:\Custom.dic")

'To create a new blank dictionary and save it as a file
Dim Dictionary = New i00SpellCheck.FlatFileDictionary("c:\Custom.dic", True)
Dictionary.Add("CustomWord1")
Dictionary.Add("CustomWord2")
Dictionary.Add("CustomWord3")
Dictionary.Save()

'To Load a custom dictionary for an individual Control:
TextBox1.SpellCheck.CurrentDictionary = Dictionary

'To Open the dictionary editor for a dictionary associated with a Control:
'NOTE: this should only be done after the dictionary has loaded (Control.SpellCheck.CurrentDictionary.Loading = False)
TextBox1.SpellCheck.CurrentDictionary.ShowUIEditor()

'Repaint all of the controls that use the same dictionary...
TextBox1.SpellCheck.InvalidateAllControlsWithSameDict()




''This is used to setup spell check settings when the spell check extension is loaded:
Private Sub ControlExtensionAdding(ByVal sender As Object, ByVal e As ControlExtensionAddingEventArgs)
    Dim SpellCheckControlBase = TryCast(e.Extension, SpellCheckControlBase)
    If SpellCheckControlBase IsNot Nothing Then
        Static SpellCheckSettings As i00SpellCheck.SpellCheckSettings 'Static for settings to be shared amongst all controls, use dim for control specific settings...
        If SpellCheckSettings Is Nothing Then
            SpellCheckSettings = New i00SpellCheck.SpellCheckSettings
            SpellCheckSettings.AllowAdditions = True 'Specifies if you want to allow the user to add words to the dictionary
            SpellCheckSettings.AllowIgnore = True 'Specifies if you want to allow the user ignore words
            SpellCheckSettings.AllowRemovals = True 'Specifies if you want to allow users to delete words from the dictionary
            SpellCheckSettings.AllowInMenuDefs = True 'Specifies if the in menu definitions should be shown for correctly spelled words
            SpellCheckSettings.AllowChangeTo = True 'Specifies if "Change to..." (to change to a synonym) should be shown in the menu for correctly spelled words
        End If
        SpellCheckControlBase.Settings = SpellCheckSettings
    End If
End Sub
//To load a single control extension on a control call: 
ControlExtensions.LoadSingleControlExtension(TextBox1, New TextBoxPrinter.TextBoxPrinter());

//To enable spell check on single line textboxes you will need to call:
TextBox1.EnableSpellCheck(null);

//If you wanted to pass in options you can do so by handling the ControlExtensionAdding event PRIOR to calling EnableControlExtensions:
ControlExtensions.ControlExtensionAdding += ControlExtensionAdding;
//Also refer to the commented ControlExtensionAdding Sub in this form for more info

//You can also enable spell checking on an individual Control (if supported):
TextBox1.EnableSpellCheck(null);

//To disable the spell check on a Control:
TextBox1.DisableSpellCheck();

//To see if the spell check is enabled on a Control:
bool SpellCheckEnabled = TextBox1.IsSpellCheckEnabled();
//To see if another control extension is loaded (in this case call see if the TextBoxPrinter Extension is loaded on TextBox1):
var PrinterExtLoaded = TextBox1.ExtensionCast<textboxprinter.textboxprinter>() != null;

//To change options on an individual Control:
TextBox1.SpellCheck(true, null).Settings.AllowAdditions = true;
TextBox1.SpellCheck(true, null).Settings.AllowIgnore = true;
TextBox1.SpellCheck(true, null).Settings.AllowRemovals = true;
TextBox1.SpellCheck(true, null).Settings.ShowMistakes = true;
//etc

//To set control extension options / call methods from control extensions (in this case call Print() from TextBox1):
object PrinterExt = TextBox1.ExtensionCast<textboxprinter.textboxprinter>();
PrinterExt.Print();

//To show a spellcheck dialog for an individual Control:
var iSpellCheckDialog = TextBox1.SpellCheck(true,null) as i00SpellCheck.SpellCheckControlBase.iSpellCheckDialog;
if (iSpellCheckDialog != null) {
    iSpellCheckDialog.ShowDialog();
}

//To load a custom dictionary from a saved file:
i00SpellCheck.FlatFileDictionary Dictionary = new i00SpellCheck.FlatFileDictionary("c:\\Custom.dic", false);

//To create a new blank dictionary and save it as a file
i00SpellCheck.FlatFileDictionary Dictionary = new i00SpellCheck.FlatFileDictionary("c:\\Custom.dic", true);
Dictionary.Add("CustomWord1");
Dictionary.Add("CustomWord2");
Dictionary.Add("CustomWord3");
Dictionary.Save(Dictionary.Filename, true);

//To Load a custom dictionary for an individual Control:
TextBox1.SpellCheck(true, null).CurrentDictionary = Dictionary;

//To Open the dictionary editor for a dictionary associated with a Control:
//NOTE: this should only be done after the dictionary has loaded (Control.SpellCheck.CurrentDictionary.Loading = False)
TextBox1.SpellCheck(true, null).CurrentDictionary.ShowUIEditor();

//Repaint all of the controls that use the same dictionary...
TextBox1.SpellCheck(true, null).InvalidateAllControlsWithSameDict(true);




//This is used to setup spell check settings when the spell check extension is loaded:
static i00SpellCheck.SpellCheckSettings SpellCheckSettings = null;//Static for settings to be shared amongst all controls, use "i00SpellCheck.SpellCheckSettings SpellCheckSettings = null;" in the method below for control specific settings...
private void ControlExtensionAdding(object sender, i00SpellCheck.MiscControlExtension.ControlExtensionAddingEventArgs e)
{
    var SpellCheckControlBase = e.Extension as SpellCheckControlBase;
    if (SpellCheckControlBase != null)
    {
        //i00SpellCheck.SpellCheckSettings SpellCheckSettings = null;
        if (SpellCheckSettings == null)
        {
            SpellCheckSettings = new i00SpellCheck.SpellCheckSettings();
            SpellCheckSettings.AllowAdditions = true; //Specifies if you want to allow the user to add words to the dictionary
            SpellCheckSettings.AllowIgnore = true; //Specifies if you want to allow the user ignore words
            SpellCheckSettings.AllowRemovals = true; //Specifies if you want to allow users to delete words from the dictionary
            SpellCheckSettings.AllowInMenuDefs = true; //Specifies if the in menu definitions should be shown for correctly spelled words
            SpellCheckSettings.AllowChangeTo = true; //Specifies if "Change to..." (to change to a synonym) should be shown in the menu for correctly spelled words
        }
        SpellCheckControlBase.Settings = SpellCheckSettings;
    }
}</textboxprinter.textboxprinter></textboxprinter.textboxprinter>

下载中的 Test 项目中包含更多示例。

插件

自 v20120618 起,i00SpellCheck 支持插件。

i00SpellCheck 中的插件允许通过创建包含继承 `i00SpellCheck.SpellCheckControlBase` 的公共类的 dll 或 exe 文件来对组件进行拼写检查。

它们会自动被拾取并允许对额外控件进行拼写检查,而无需引用文件本身。但是,您需要将它们放在应用程序路径中。

使用插件允许用户启用对其控件的拼写检查,而无需更改 i00SpellCheck 项目。

另一个用途是允许程序员快速查看他们在窗体等上是否有拼写错误。例如,将 `LabelPlugin.exe` 文件放在应用程序路径中(该应用程序已使用 i00SpellCheck),那么现有项目中的所有标签都将被拼写检查……无需更改代码!当开发人员想要部署他们的应用程序时,他们只需删除 LabelPlugin.exe 文件,标签就不会再被纠正。

创建插件的基本步骤如下:

  • 从创建一个新项目(类库或 exe)开始
  • 引用 i00SpellCheck
  • 创建一个继承 `i00SpellCheck.SpellCheckControlBase` 的类
  • 覆盖 `ControlType` 属性,以返回您希望插件拼写检查的控件类型
  • 添加您的代码

有关继承 `i00SpellCheck.SpellCheckControlBase` 的示例,请查看下载中 Plugins 路径中的示例。

项目

包含的项目及其简要说明如下:

  • i00SpellCheck - 包含拼写检查核心/`TextBox` 和 `DataGridView` 插件的类,以及其他插件正常工作所需的核心组件
  • Plugins\LabelPlugin - 包含一个检查 `Labels` 拼写的插件
  • Plugins\OSControlRenderer - 包含一个渲染 `TreeView` 和 `ListViews` 以使其外观与 Windows 中一致的插件
  • Plugins\SelectedControlHighlight - 包含一个扩展各种 `Controls` 以使其在被选中时出现“发光”效果的插件
  • Plugins\TextBoxPrinter - 包含一个扩展 `TextBoxBase` 以支持打印的插件
  • Plugins\TextBoxSpeechRecognition - 包含一个扩展 `TextBoxBase` 以支持语音输入(双击 F12)和听写的插件
  • Plugins\TextBoxTranslator - 包含一个扩展 `TextBoxBase` 以支持 Google 翻译的插件
  • Plugins\3rd Party\FastColoredTextBoxPlugin - 包含一个检查 FastColoredTextBox 控件拼写的插件,由 Pavel Torgashov 提供
  • Tests\BasicTest - 一个包含 i00 Spell Check 基本实现的测试项目
  • Tests\CSharpTest - 一个演示在 C# 中使用 i00 Spell Check 的测试项目
  • *Tests\Test - 一个包含 i00 Spell Check 和控件扩展高级实现的测试项目
  • Tests\3rd Party Dictionaries\HanksDictionaryTest - 一个演示在 i00 Spell Check 中使用第三方拼写引擎的测试项目。此处为 Hank 的字典(由 tewuapple (Hank) 提供)
  • Tests\3rd Party Dictionaries\OpenOfficeHunspellDictionaryTest - 一个演示在 i00 Spell Check 中使用第三方拼写引擎的测试项目。此处为 Hunspell,支持 Open Office 字典
  • Tests\3rd Party Dictionaries\WordDictionaryTest - 一个演示在 i00 Spell Check 中使用第三方拼写引擎的测试项目。此处为 Microsoft Word

* = 默认启动项目

关注点

被检查的单词会被添加到字典缓存中以加快检查速度——较小的缓存会先被检查。如果单词在缓存中找不到,则检查主字典。

对于一些基本类,我使用字段(`public` 变量)而不是属性,因为它们比属性快大约 2 倍。

下载次数

总下载量:

每日下载量

更改日志

(粗体项目是最终用户会注意到的)

20140111

i00SpellCheck
  • 修复了单行文本框问题,即 EnableSpellCheck 需要被调用两次(由 hoodch 发现)
  • 更新了插件管理器到最新版本……现在支持路径和影子复制(此项目未实现)
  • 向拼写检查对话框添加了帮助按钮(对于不知道按住 F1 的人)
测试
  • 使启用按钮在演示窗体的每个选项卡上都能正常工作
TextBoxSpeechRecognition
  • 修复了听写中的一些问题,即它不会插入听写文本
  • 现在按 Enter 键提交听写文本
KonamiCode WebpageImplementation
  • 开始了网页界面实现的尝试(目前处于非常初级的阶段)

20130521

i00SpellCheck
  • 修复了当多个 textboxbase 共享上下文菜单时发生的错误(由 Adviser 发现)
  • DataGridView 的 CellStyle 不再需要设置为 WrapMode.True 即可在 DataGridView 中显示更正
  • 修复了一个可能的渲染问题,即在某些情况下未绘制错误下划线
  • 修复了一个可能的错误,即在极少数情况下,拼写检查对话框在打开时会出错(由 TheComputerMan08 (Brent) 发现)
  • 修复了一个问题,即以大写字母开头的单词未被拼写检查拾取
  • 修复了一个错误,即如果使用默认的 ShowUIEditor 函数选择新字典,控件不会从缓存中清除旧的正确单词
  • 现在自动拼写 SplitContainers 中的控件(由 cognositivo 发现)
FastColoredTextBoxPlugin
  • 为 FCTB 添加了 HTML 示例,带有 HTML 颜色高亮
  • 将 FCTB 更新到最新版本
  • 修复了 FCTB 的一个问题,即插入文本时,所有文本都会被拼写检查,而不是仅可见范围,从而加快了大型复制粘贴的速度
HanksDictionaryTest
  • 添加了使用 i00 Spell Check 的另一个字典示例……Hank 的字典(由 tewuapple (Hank) 提供)
WordDictionaryTest
  • 添加了使用 i00 Spell Check 的另一个字典示例……Word 字典

20130114

i00SpellCheck
  • 添加了用于创建更通用控件扩展的引擎
  • 将 SpellCheckControlBase 的工作方式更改为使用更通用的控件扩展
  • 默认字典加载现在是多线程的,即使仅调用 .SpellCheck
  • 控件扩展现在可以指定多个 ControlTypes
  • 将 TextBoxBase 的更改大小写功能放入自己的控件扩展中
  • 将更漂亮的 TextBoxBase 上下文菜单放入自己的控件扩展中
  • 使窗口动画更平滑、更稳定,用于 F7 等
  • 控件扩展现在可以依赖于其他控件扩展(类似于引用,但在控件扩展内)
TextBoxPrinter
  • 添加了 TextBoxPrinter 插件
TextBoxSpeechRecognition
  • 添加了触发听写和语音的按钮
  • 自定义卡拉 OK 渲染控件已添加到测试窗体
  • 现在使用新的、更通用的控件扩展,而不是扩展 SpellCheckTextBox
  • 在 Windows 8 中,语音不再在每行末尾“中断”
OSControlRenderer
  • 添加了 OSControlRenderer 插件
SelectedControlHighlight
  • 添加了 SelectedControlHighlight 插件
TextBoxTranslator
  • 添加了 TextBoxTranslator 插件
测试
  • 整洁化了 Draft Plan 渲染

20121102

i00SpellCheck
  • 使 SpellCheckDialog 更通用(以便更容易与其他控件一起使用)
  • 修复了使用 SpellCheckDialog 进行拼写检查时,文本框会在确认更改时闪烁和重绘多次的错误
  • 添加了 IgnoreWordsInUpperCase 设置(由 TheMperor 请求)
  • 添加了 IgnoreWordsWithNumbers 设置(由 TheMperor 请求)
  • 修复了一个错误,该错误会导致气球式工具提示在屏幕左侧时出现问题,这可能导致拼写检查对话框崩溃
测试
  • 为 Performance Monitor 窗口添加了一些选项
OpenOfficeHunspellDictionary
  • Hunspell 现在具有大小写错误下划线
  • 为 Hunspell 测试项目添加了 Hunspell 同义词查找
TextBoxSpeechRecognition
  • 使用语音时显示托盘图标
  • 在说话时添加了卡拉 OK 风格的内容菜单项
  • 现在,当触发语音或听写时,所有语音实例(跨所有使用 i00 拼写检查的应用程序)都会被终止,这样就不会出现“多人”同时说话的情况

20120920

  • 添加了性能计数器
  • 修复了内置字典中的一个错误,该错误导致字典索引被用户单词填满并可能导致错误,这也大大加快了拼写检查速度
  • 修复了拼写检查对话框的一个问题,如果您有大量数据,它会“冻结”

20120914

  • 为富文本框的上下文菜单添加了“重做”
  • 更改了将项目添加到拼写检查文本框上下文菜单的方式,使其更具可扩展性
  • TextBoxSpeechRecognition 现在向 TextBoxBase 上下文菜单添加菜单项
  • 为 TextBoxSpeechRecognition 添加了属性以调整各种设置
  • 修复了一个在获取单词建议时可能导致错误的错误,当时无法做出任何建议

20120907

  • 删除了项目中一些冗余的内容
  • 在测试窗体中添加了一个按钮,该按钮会弹出字典编辑器
  • 更改了平面文件字典索引的存储方式
  • 更改了平面文件字典在内存中的存储方式
  • 对字典进行了大量更改,以支持用户字典的创建,用于继承的字典类
  • 添加了一个 C# 测试项目
  • 添加了一个测试项目,演示人们如何在使用 i00 Spell Check 时使用其他拼写引擎。此处为 Hunspell,支持 Open Office 字典

20120903

  • 添加了 SpellCheckControlAdding 事件,允许您返回 e.Cancel = True 以防止控件被检查
  • 修复了一个错误,即如果您在多个窗体上多次调用 .EnableSpellCheck,可能会导致错误(由 rfreedlund 发现)
  • 索引字典 - 略微增加了初始加载时间……但显著加快了检查速度(由 Maverickz 请求)
  • 修复了一个罕见的错误,即拼写检查缓存会抛出错误
  • 用户字典文件现在与内置字典分开
  • 已忽略的单词现在存储在用户字典中
  • 更新了 FlatFile 字典编辑器以支持新的用户字典
  • 为 FlatFile 字典编辑器添加了 i00Binding List 到项目...如果您愿意,可以删除该引用,但首先必须删除字典编辑器(位于 i00SpellCheck\Spell Check\Engine\Dictionary\Flat File\Editor 中),如果您不需要它
  • 对字典进行了重大更改,以支持自定义类来检查其他字典格式
  • 添加了一个扩展 SpellCheckTextbox 的插件,为其添加了语音识别功能!但是,Microsoft 的内置语音识别并不出色。快速按两次 F12 进行语音识别
  • 使内置插件更具可扩展性

20120625

  • 更改了单词添加到字典缓存的方式(提高了拼写检查速度)
  • 提高了 FastColoredTextBox 插件的速度
  • 使测试项目自动拾取项目路径中的任何插件,并将它们自动添加到选项卡中——插件的引用不是必需的,它们被添加到 LabelPlugin 和 FastColoredTextBoxPlugin 中,以便在项目构建时它们会自动放置在同一个文件夹中!

20120622 - FastColoredTextBox

  • 更改了拼写检查器的一些内部工作方式
  • 添加了对 FastColoredTextBox 的支持,包括插件!

20120618 - 插件!

  • 在项目中添加了测试插件,该插件提供了拼写检查标签的功能
  • 更改了拼写检查的结构/内部工作方式……使拼写检查更模块化,并可能支持插件!
  • 修复了一个在某些情况下未将设置应用于拼写检查控件的错误
  • 即使单元格未被编辑,网格视图的拼写检查现在也会在单元格上显示

20120609 - DataGridView 搞定!

  • 添加了对 DataGridViews 的支持(由 in2tech 请求)
  • 修复了一个错误,即在禁用自动换行时,下划线未在正确位置绘制
  • 修复了一个错误,即单行文本框并不总是显示拼写错误

20120608 - 禁用和错误修复

  • 修复了一个错误,即如果单词开头有撇号,它会推挤下划线间距(由 jwinney 发现)
  • 添加了在 TextBox 上禁用拼写检查的功能(由 Gabriel X 请求)
  • 修复了一个错误,即标准 TextBox 在添加新渲染方法后没有正确刷新
  • 修复了一个错误,即如果 TextBox 包含错误并且删除了所有文本,下划线仍然显示(由 jim400 发现)
  • 一些小的界面更改,包括启动屏幕和菜单的“alt”键

20120203

  • 工具提示现在支持图像,并且为某些定义添加了图像
  • 修复了工具提示渲染问题
  • 您现在可以按 F3 更改所选文本的大小写(由 rykk 请求)
  • 将“-”分类为单词分隔符字符
  • 修复了一个会重新绘制文本框错误两次的错误
  • 如果在 STA 线程上不启用 Cut/Copy/Paste 选项,则禁用它们,因为这会出错

20120102 - 新年快乐!

  • 修改了定义,使其从文件中动态查找,而不是加载到内存中,以减少 RAM 使用量 ~节省 56MB!
  • 更改了设置,以便所有拼写检查设置都在一个类中
  • 清理了 `SpellCheckTextBox` 类及其子类,以便可以使用属性网格轻松编辑设置
  • 为测试项目添加了属性网格
  • 添加了字典编辑器
  • 在解决方案中添加了一个“精简版”测试项目,让用户更容易看到在项目中集成 i00 .NET Spell Check 的简单性!
  • 更改了渲染方法以消除重绘闪烁,并添加了一个设置来恢复到旧的渲染方法“`RenderCompatibility`”

20111202 - 现在带对话框了!

  • 清理了一些东西……将 HTML 格式的工具提示+ HTML `ToolStripItem` 移到了自己的控件中
  • 使文本 `ToolStripSeperator` 看起来和功能更好
  • 使右键菜单项可移植,以便可以将其添加到任何菜单中用于其他用途——不再与文本框紧密绑定
  • 实现了拼写检查对话框,用于 F7 风格的拼写检查(选择文本框并按 F7!...也可以通过:`TextBoxName.SpellCheck.ShowDialog()` 调用)

20111109 - 菜单中的定义、同义词和修复!

  • 更改了工具提示定义,使其匹配更多来自词库的单词,例如,“suggestions”匹配“suggestion”以获取定义,因为没有明确匹配“suggestions”的定义,并在提示中指出它是复数
  • 定义工具提示现在是所有者绘制的,使其看起来更好
  • 修复了一个大小写匹配错误,即“This”会建议“this”而不是“This”(由 TxDeadhead 请求)
  • 像“Chris's”这样的单词现在建议“Chris'”而不是“Chris's”
  • 以“'”结尾的单词不再被视为拼写错误
  • 如果上下文菜单靠近屏幕底部或右侧,则使其定位更好
  • 修复了一个错误,即如果多次按下键盘上的上下文菜单按钮,菜单会将相同的更正添加到上下文菜单中
  • 加快了字典文件的加载速度
  • 修复了定义文件中的一个错误——所有形容词和副词都混淆了(即,所有形容词都被列为副词,所有副词都被列为形容词)!
  • 查找单词建议的各种速度优化,查找拼写错误的单词“suggestions”曾经需要约 250 毫秒,现在降至约 150 毫秒
  • 改进了建议查找,现在对重复词多的单词或缺失词的单词(例如“running”,“running”>“running”)赋予更高的权重
  • 为正确拼写的单词添加了上下文菜单定义(由 Dean 请求)
  • 具有特殊大小写的单词(例如 SUpport,SupporT 等)现在可以被拾取(由 TxDeadhead 请求)
  • 如果字典、定义或同义词文件被删除,现在不会崩溃,只会移除该部分的功能
  • 添加了同义词;“更改为...”菜单项(由 NtEditor 请求)

20111106 - 很忙!

  • 各种速度优化
  • 字典现在存储为平面文件,便于移植
  • 为拼写错误添加了所有者绘制支持
  • 添加了自定义高亮显示拼写错误颜色的功能
  • 添加了一些关于如何自定义拼写检查外观的示例
  • 为拼写建议添加了单词定义……因此,如果您不确定建议中的正确拼写,可以从定义中选择正确的
  • 当按下键盘上的上下文菜单按钮时,.NET 中的右键菜单会从文本框的中间弹出——现在已修改为从插入符号位置弹出
  • 填字游戏生成器——计划稍后添加解谜器!
  • 添加了对富文本框的支持
  • 添加了建议查找示例

20111011 - 一些有趣的附加功能

  • 添加了字谜查找
  • 添加了 Scrabble 助手

20111008 - 小改动

  • 修复了一个错误,即文本框下划线最初不会始终绘制,直到文本框滚动或文本发生更改
  • 清理了界面,使其看起来更专业

20111006

  • 初始发布

潜在问题

SpellCheckTextBox

由于 Textbox 没有真正“漂亮”地在其上绘制的方法,我以前会捕获控件的 `WM_PAINT`,然后绘制在通过 `Graphics.FromHwnd` 设置的文本框图形上……这似乎效果很好,但会产生轻微的闪烁,我认为这是不期望的……

从 v20120102 开始,渲染方法现在使用分层窗口(默认情况下),这基本上意味着所有绘制在控件上的下划线实际上是绘制在控件上方的另一个窗口上……

那么这对用户有什么影响呢?在大多数情况下,没有影响,窗体是可点击的,只有绘图可见,而不是窗体本身。事实上,如果您在 Windows Vista/7 中按开始 + Tab 键激活 Flip3D,它甚至会显示在同一个窗口上!

正如我上面所说,“在大多数情况下”……

MIDI 窗体我没有测试过,但很确定它们在使用新的渲染方法时不起作用。

对于重叠的文本框,下方控件上的文本更正会“浮动”到上面的控件上,并且如果文本框不在窗体上,更正会“浮动”到窗体外!

因此,在上述情况下,您必须回到旧的“兼容”渲染,在这种情况下可以通过以下方式进行:

DirectCast(TextBox.SpellCheck, SpellCheckTextBox).RenderCompatibility = True

谢谢

特别感谢 Pavel Torgashov 提供了他出色的 FastColoredTextBox 控件。该控件在解决方案中用于通过 i00SpellCheck 插件来测试 i00SpellCheck 与第三方控件的插件架构。i00 未以任何方式修改此控件,仅负责通过 i00SpellCheck 插件将拼写检查功能集成到其中。此控件并非对解决方案中其他项目的拼写检查功能所必需。

感谢下载。

非常感谢关于可能改进的建议。

© . All rights reserved.