i00 拼写检查和控件扩展 - 无需第三方组件!
.NET 简单易用的开源拼写检查器
![]() |
任何希望在其项目中使用此代码的人都可以这样做,但要求在此页面上发表帖子,说明他们正在使用它。 一个简单的“我在项目中使用 i00 Spell check”就足够了。 |
引言
我想要一个可以在 .NET 中使用的拼写检查器,所以就像大多数人会做的那样,我谷歌了一下。经过数小时徒劳的搜索,我决定自己做一个;当然,外面有很多拼写检查器,但我不想使用依赖于 Word 等第三方组件或需要 Internet 连接才能工作的拼写检查器。隆重推出 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 项目中还包含了更多示例。
插件
自 20120618 版本以来,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 需要使用 2 次(由 hoodch 发现)
- 更新了插件管理器到最新版本……现在支持路径和影子复制(此项目未实现)
- 在拼写检查对话框中添加了帮助按钮(适用于不知道按住 F1 的人)
TextBoxSpeechRecognition
- 使 enabled 按钮在演示窗体的每个选项卡上都起作用
KonamiCode
- 修复了听写中的一些问题,例如不会插入听写文本
- 现在输入即可提交听写文本
WebpageImplementation
- 添加了 KonamiCode 插件(使用了 C# MIDI 工具包,作者:Leslie Sanford)
- 开始实现 Web 界面(目前处于非常基础的阶段)
20130521
i00SpellCheckFastColoredTextBoxPlugin
- 修复了当多个 textboxbases 共享上下文菜单时发生的错误(由 Adviser 发现)
- DataGridView CellStyle 不再需要设置为 WrapMode.True 即可在 DataGridView 中显示更正
- 修复了在某些情况下可能不会绘制错误下划线的渲染问题
- 修复了在极少数情况下,拼写检查对话框打开时会出错的潜在错误(由 TheComputerMan08 (Brent) 发现)
- 修复了以大写字母开头的单词未被拼写检查拾取的问题
- 修复了一个错误:如果使用默认的 ShowUIEditor 函数选择新字典,控件不会从缓存中清除旧的正确单词
- 现在自动拼写 SplitContainers 中的控件(由 cognositivo 发现)
HanksDictionaryTest
- 为 FCTB 添加了 HTML 示例,带有 HTML 颜色高亮
- 将 FCTB 更新到最新版本
- 修复了 FCTB 的一个问题:在插入文本时,所有文本都会被拼写检查,而不是只检查可见范围,从而加快了大型复制粘贴的速度
WordDictionaryTest
- 添加了另一个使用不同字典的示例,用于 i00 Spell Check... Hanks Dictionary(作者:tewuapple (Hank))
- 添加了另一个使用不同字典的示例,用于 i00 Spell Check... Word Dictionary
20130114
i00SpellCheckTextBoxPrinter
- 添加了使控件扩展更通用的引擎
- 更改了 SpellCheckControlBase 的工作方式,以使用更通用的控件扩展
- 默认字典加载现在是线程化的,即使只调用 .SpellCheck
- 控件扩展现在可以指定多种 ControlTypes
- 将 TextBoxBase 的更改大小写功能放入了自己的控件扩展中
- 将更漂亮的 TextBoxBase 上下文菜单放入了自己的控件扩展中
- 使窗口动画更流畅、更稳定(例如 F7)
- 控件扩展现在可以依赖于其他控件扩展(类似于引用,但属于控件扩展内部)
TextBoxSpeechRecognition
- 添加了 TextBoxPrinter 插件
OSControlRenderer
- 添加了用于触发听写和语音的按钮
- 自定义卡拉 OK 渲染控件已添加到测试窗体
- 现在使用新的、更通用的控件扩展,而不是扩展 SpellCheckTextBox
- 在 Windows 8 中,语音不再在每行末尾“断断续续”
SelectedControlHighlight
- 添加了 OSControlRenderer 插件
TextBoxTranslator
- 添加了 SelectedControlHighlight 插件
测试
- 添加了 TextBoxTranslator 插件
- 改进了 Draft Plan 的渲染
20121102
i00SpellCheck测试
- 使 SpellCheckDialog 更通用(以便更容易与其他控件一起使用)
- 修复了一个错误:在使用 SpellCheckDialog 进行拼写检查时,文本框会在确认更改后闪烁并重绘数次
- 添加了 IgnoreWordsInUpperCase 设置(由 TheMperor 请求)
- 添加了 IgnoreWordsWithNumbers 设置(由 TheMperor 请求)
- 修复了一个错误,该错误会导致气球式工具提示在屏幕左侧时出现问题,这可能导致拼写检查对话框崩溃
OpenOfficeHunspellDictionary
- 在 Performance Monitor 窗口中添加了一些选项
TextBoxSpeechRecognition
- Hunspell 现在具有大小写错误下划线
- 在 Hunspell 测试项目中添加了 Hunspell 同义词查找
- 使用语音时会出现托盘图标
- 在说话时添加了一个卡拉 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 请求)
- 将“-”分类为单词分隔符字符
- 修复了一个会导致文本框错误地重绘 2 次的错误
- 禁用菜单中的剪切/复制/粘贴选项,如果不在 STA 线程上,这会导致错误
20120102 - 新年快乐!
- 修改了定义,使其动态从文件查找而不是加载到内存中,以减少 RAM 使用量 ~节省 56MB!
- 更改了设置,以便所有拼写检查设置都在一个类中
- 清理了
SpellCheckTextBox
类及其子类,以便使用属性网格轻松编辑设置 - 向测试项目添加了属性网格
- 添加了一个字典编辑器
- 向解决方案中添加了一个“精简版”测试项目,以便用户更轻松地了解在项目中使用 i00 .NET Spell Check 有多容易!
- 更改了渲染方法以消除重绘闪烁,添加了一个设置以恢复到旧的渲染方法“
RenderCompatibility
”
20111202 - 现在有对话框了!
- 清理了一些东西……将 HTML 格式的工具提示 + HTML
ToolStripItem
移到了它们自己的控件中 - 使 Text
ToolStripSeperator
看起来和功能更好 - 使右键菜单项可移植,以便它们可以添加到任何菜单中用于其他目的——而不是与文本框紧密绑定
- 实现了一个拼写检查对话框,用于 F7 风格的拼写检查(选择文本框并按 F7!...也可以通过:
TextBoxName.SpellCheck.ShowDialog()
调用)
20111109 - 菜单内定义、同义词和修复!
- 更改了工具提示定义,使其匹配更多单词基础中的单词,例如,“suggestions”匹配“suggestion”用于定义,因为没有明确匹配 suggestions 的定义,并在提示中说明它是复数
- 定义工具提示现在是所有者绘制的,使其看起来更漂亮
- 修复了一个大小写匹配错误,即“This”建议“this”而不是“This”(由 TxDeadhead 请求)
- 像“Chris's”这样的单词现在建议“Chris'”而不是“Chris's”
- 以 ' 结尾的单词不再被视为拼写错误
- 使上下文菜单在靠近屏幕底部或右侧时定位得更好
- 修复了一个错误,即如果多次按下键盘上的上下文菜单按钮,菜单会在上下文菜单中添加多个相同的更正
- 加快了字典文件的加载速度
- 修复了定义文件中的一个错误——所有形容词和副词都混淆了(即,所有形容词都被列为副词,所有副词都被列为形容词)!
- 各种查找单词建议的速度优化,查找拼写错误的单词“suggestions”曾经需要约 250ms,现在降至约 150ms
- 改进了建议查找,现在对具有额外重复项或缺失重复项的单词(例如“running”、“running”>“running”)赋予更高的权重
- 添加了已正确拼写单词的上下文菜单定义(由 Dean 请求)
- 具有有趣大小写的单词(例如 SUpport、SupporT 等)现在会被拾取(由 TxDeadhead 请求)
- 现在,如果字典、定义或同义词文件被删除,也不会崩溃——只会移除该部分的功能
- 添加了同义词;“更改为...”菜单项(由 NtEditor 请求)
20111106 - 很忙!
- 各种速度优化
- 字典现在存储为平面文件,便于移植
- 为拼写错误添加了所有者绘制支持
- 添加了自定义高亮显示拼写错误单词颜色的功能
- 添加了一些如何自定义拼写检查外观的示例
- 添加了拼写建议的单词定义……因此,如果您不确定建议中的正确拼写,您可以从定义中选择正确的
- 当按下键盘上的上下文菜单按钮时,.NET 中的右键菜单会从文本框的中间弹出——现在已对其进行修改,使其从插入符号位置弹出
- 填字游戏生成器——计划稍后制作解谜器!
- 为富文本框添加了支持
- 添加了建议查找示例
20111011 - 一些有趣的附加功能
- 添加了字谜查找
- 添加了 Scrabble 助手
20111008 - 小幅改动
- 修复了一个错误,即文本框下划线最初可能不会始终绘制,直到文本框滚动或文本更改
- 清理了界面,使其看起来更专业
20111006
- 初始发布
可能存在的问题
SpellCheckTextBox
由于 Textbox 没有真正“精美”绘制它的方法,我以前会捕获控件的
WM_PAINT
,然后绘制到通过Graphics.FromHwnd
设置的文本框图形上……这似乎效果很好,但会产生轻微的闪烁,我认为这是不希望的……从 20120102 版本开始,渲染方法现在(默认)使用分层窗口,这基本上意味着所有看起来绘制在控件上的下划线实际上是绘制在另一个窗口上,覆盖在控件之上……
这会如何影响用户?嗯,在大多数情况下,它不会,窗体是可点击的,只有绘图可见,而不是窗体本身。事实上,如果您在 Windows Vista / 7 中按住开始键 + Tab 激活 Flip3D,它甚至会出现在同一个窗口上!
正如我上面所说的,“在大多数情况下”……
MIDI 窗体我尚未测试,但相当确定它们在使用新的渲染方法时将无法正常工作。
对于重叠的文本框,下面控件上的文本更正会“浮动”到上面的控件上,如果文本框在窗体外部,更正也会“浮动”到窗体外部!
因此,在上述情况下,您将不得不切换回旧的“兼容”渲染,在这些情况下可以通过以下方式完成:
DirectCast(TextBox.SpellCheck, SpellCheckTextBox).RenderCompatibility = True
谢谢
特别感谢 Pavel Torgashov 提供的优秀 FastColoredTextBox 控件。该控件在解决方案中用于通过 i00SpellCheck 插件测试 i00SpellCheck 的插件架构与第三方控件。i00 未以任何方式修改此控件,仅负责通过 i00SpellCheck 插件将其集成拼写检查功能。此控件在任何情况下都不是解决方案中其他项目拼写检查功能所必需的。
感谢下载。
非常感谢关于可能改进的建议。