在拼写检查Win10文本 - 慢 [英] Spell check textbox in Win10 - Slow

查看:228
本文介绍了在拼写检查Win10文本 - 慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是内置在WPF拼写检查器。它工作得很好,直到我的用户开始升级到Windows 10 ...我认为这个问题是,它被用于很多小文本框。我的应用程序提供了一个网格(Telerik的TreeListView)与文本框,我想拼写检查的一列。我需要能够提供自定义词典的拼写检查;我能做到这一点的唯一方法是订阅文本框加载事件,并添加路径,如下所示:

I'm using the built in spell checker in WPF. It was working just fine until I had users start upgrading to windows 10... I think the issue is that it's being used for a lot of small text boxes. My application presents a grid (Telerik's TreeListView) with text boxes for one of the columns which i want spell checked. I need to be able to provide a custom dictionary to the spell checker; the only way I was able to do this was to subscribe to the textbox loaded event and add the paths in as follows:

        TextBox tb = sender as TextBox;
        tb.ContextMenu = ctx_Spell;
        IList dcts = SpellCheck.GetCustomDictionaries(tb);

        dictsList.Add(dcts);
        if (KMApplication.Settings.UserDictionary != null)
        { dcts.Add(KMApplication.Settings.UserDictionary); }

        foreach (Uri dct in KMApplication.Settings.RevitDictonaries)
        { dcts.Add(dct); }



当然这要求添加为每似乎非常浪费每一个文本框,但它似乎工作得很少有明显的滞后,只有在加载了罚款。但是现在在Windows 10这似乎是一个可笑的滞后。在我的Windows 8.1的机器我加载了一个文件,几千行,它出现在约3或4秒;在我的Windows 10中,它出现在10-15分钟左右。如果我注释掉上面的代码又回到了约3-4秒,无论是机器上的自定义词典的部分。

Granted this calls the add for each and every text box which seems terribly wasteful, but it seemed to be working just fine with little noticeable lag and only on load up. However now on Windows 10 it seems to be a ridiculous lag. On my Windows 8.1 machine I load up a file with a few thousand rows and it appears in about 3 or 4 seconds; on my Windows 10 box, it appears in about 10-15 minutes. If I comment out the custom dictionaries portion of the above code it's back to about 3-4 seconds on either machine.

有谁知道一个更好的方式来做到这一点?或者,如果在它周围有某种方式在Win10

Does anyone know a better way to do this? Or if there is some way around it in Win10?

推荐答案

启动.NET 4.6.1(在Win8.1&放大器; Win10 ),WPF使用由OS暴露于实现其拼写检查ISpellChecker接口,以及性能特征可能会略有不同确实。

Starting .NET 4.6.1 (in Win8.1 & Win10), WPF uses ISpellChecker interface exposed by the OS to implement its SpellChecker, and the performance characteristics could be somewhat different indeed.

值得注意的是,ISpellChecker的自定义词典登记员行为全球 - 它不再作为每个控件注册。 (请参阅下面的知识库文章链接)。其结果,反复注册同一组的字典为每个控制是一种浪费,并有可能降低的性能。此外,操作系统会刚开始忽略你的字典,当它达到内部限制。

Notably, ISpellChecker's custom dictionary registrar acts globally - it no longer acts as a per-control registration. (See KB article link below). As a result, registering the same set of dictionaries over and over for each control is wasteful and can potentially degrade your performance. Besides, the OS will just start ignoring your dictionaries when it reaches an internal limit.

只需注册一次字典,或者使用的 http://blogs.msdn.com/b/wpf/archive/2015/10/29/wpf-在净4-6-1.aspx ,并放置在%APPDATA%\microsoft\spelling\的文件。

Just register the dictionaries once, or use the alternative registration mechanism outlined at http://blogs.msdn.com/b/wpf/archive/2015/10/29/wpf-in-net-4-6-1.aspx and place the files under %appdata%\microsoft\spelling\.

如果您需要运行Win7上/ Win8的相同的应用程序以及Win8.1 / Win10,你可能需要检测操作系统和分支的字典注册策略。

If you need to run the same application on Win7/Win8 as well as Win8.1/Win10, you may need to detect the OS and branch your dictionary registration strategy.

在自定义词典一般情况下,典型用途应继续努力,像往常一样 - 在VS以前的版本.NET 4.6.1之间的差别不大。

In general, typical uses of custom dictionaries should continue working as usual - with little difference between .NET 4.6.1 vs previous releases.

另请参见 https://开头support.microsoft.com/en-us/kb/3088234 了解更多信息。

Also see https://support.microsoft.com/en-us/kb/3088234 for additional information.

这篇关于在拼写检查Win10文本 - 慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆