简体   繁体   English

内置有拼写检查功能的Win Form Webbrowser控件

[英]Win Form Webbrowser Control built in spell check

I am trying to implement a built-in spell checker for a Webbrowser control. 我正在尝试为Webbrowser控件实现内置的拼写检查器。 I have the spell check functions complete using NHunspell but I have not been able to implement the red underlining (or other function) that would tell the user the word is spelled wrong. 我已经使用NHunspell完成了拼写检查功能,但是我无法实现红色下划线(或其他功能),该红色下划线会告诉用户单词拼写错误。 I have attempted many different routes to obtain this functionality. 我尝试了许多不同的途径来获得此功能。 I have even tried the webkit.net and Gecko Webbrowsers, still nothing. 我什至尝试过webkit.net和Gecko Webbrowsers,仍然没有。

All I want to do is highlight or underline a word within a text field of a Webbrowser control. 我要做的只是在Webbrowser控件的文本字段内突出显示或加下划线。

You'd need to extract the text from the DOM and normalize text-nodes (so "he<span>ll</span>o" becomes "hello" ) and then pass that into your spellchecker. 您需要从DOM中提取文本并规范化文本节点(因此"he<span>ll</span>o"变为"hello" ),然后将其传递到拼写检查器中。 You would then need to surround the incorrect text fragments with a <span> element (in a correct fashion, so you can't surround a <div> with a span for example, you'd need to devise an algorithm that takes this into account). 然后,您需要用<span>元素将不正确的文本片段包围起来(以正确的方式,因此,例如,您不能用<div>包围<div> ,您需要设计一种算法来将其纳入帐户)。

With CSS2 your only options are for simple solid, dashed or dotted red underlines or using a wavy-underline defined as a repeating background image aligned to the bottom edge. 使用CSS2,您唯一的选择是简单的实线,虚线或虚线红色下划线,或使用波浪下划线定义为与底边对齐的重复背景图像。 I believe CSS3 makes it easier. 我相信CSS3使它变得更容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM