如何在MFC中的CRichEditCtrl中显示红色波浪线 [英] How to display Red Squiggly Lines in CRichEditCtrl in MFC

查看:210
本文介绍了如何在MFC中的CRichEditCtrl中显示红色波浪线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力在MFC应用程序中实现拼写检查器.我要做的是在拼写错误的单词下显示红线.

I am working on implementing spellchecker in an MFC application. What I want to do is display red lines under incorrectly spelled words.

我找到了一个完成此操作的示例,但它仅适用于简单的编辑框,因为它可以简单地使用编辑控件的默认字体进行计算以绘制波浪线.但是它不适用于丰富的编辑控件,因为在丰富的编辑控件中,不同的单词可能具有不同的字体.在这种情况下,我发现的示例在错误的位置绘制线.

I found one example where it is done but it works only for a simple edit box because it can simply use the edit controls default font for doing calculations to draw the squiggly lines. But it does not work for a rich edit control as in rich edit control it is possible that different words can have different fonts. In this case the example I found draws lines at incorrect places.

请让我知道是否有人已经为CRichEditCtrl完成了此操作? (它必须处理Rich Edit控件中存在的任何字体/大小的文本.)

Please let me know if someone has already done this for CRichEditCtrl? (it must handle text of any font/size that is present in the rich edit control.)

谢谢, 萨钦(Sachin)

Thanks, Sachin

推荐答案

CHARFORMAT2 format;
SecureZeroMemory(&format, sizeof(CHARFORMAT2));
format.cbSize = sizeof(CHARFORMAT2);
format.dwMask = CFM_UNDERLINE|CFM_UNDERLINETYPE;
format.dwEffects = CFE_UNDERLINE;
format.bUnderlineType = CFU_UNDERLINEWAVE | 0x50;
SendMessage(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&format);

我希望这会在您的文字中加下划线

I hope this will get the underline in your text

这篇关于如何在MFC中的CRichEditCtrl中显示红色波浪线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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