MFC:在 CRichEditCtrl 中突出显示一条线一段时间,然后恢复
MFC: Highlight a line in CRichEditCtrl for some duration and revert back
我对MFC很陌生,C++编程,请帮助我解决这个问题。在编辑框(使用 CRichEditCtrl 创建)中,有几行。我需要突出显示一行(红色)一段时间(例如:突出显示第 1 行 1 秒,然后恢复线条颜色)。
我该怎么做?提前致谢
首先像这样设置你的设置
'
// Select your string (start is the index in characters (not in lines)
GetRichEditCtrl().SetSel( nStart, nStart + nLength);
// Get the CHARFORMAT structure ready
CHARFORMAT cf;
cf.cbSize = sizeof (cf);
cf.dwEffects = 0;
cf.dwMask = CFM_COLOR;
cf.crTextColor = RGB(255,0,0);
GetRichEditCtrl().SetSelectionCharFormat(cf);
'
然后创建一个像SetTimer(WMT_MYTIMER,1000,NULL)
一样的计时器,覆盖OnTimer,用KillTimer
停止计时器并重置颜色,如上所示
希望这有帮助!
相关文章:
- 在做一段时间内检查字符的无限循环
- ExtTextOut 文本的持续闪烁,在一段时间后,文本将恢复为默认字体
- 对于等待以 std::future wait() 返回的函数的 CPU 使用率或检查标志在循环中休眠一段时间哪个更好?
- ::grpc::ServerReaderWriter 对象在另一个线程中一段时间后无法调用
- 一段时间后 CPU 使用率高
- 有没有办法在一段时间后将流程从流出中分离出来
- 在一段时间内更改标签文本
- 布尔函数在一段时间内不起作用
- 解决PNP在一段时间后返回坏的rvec和tvec
- 相机的旋转方向在一段时间后反转
- boost::asio::d eadline_timer 1ms 滞后一段时间
- SDL_Mixer再次播放时,从随机位置开始一段时间,然后从头开始
- 您可以在一段时间内迭代向量
- 列表STL的时间复杂性在一段时间内进行排序
- 我的开关菜单在一段时间循环中出现问题
- 如何在一段时间内更新 QLabel?
- switch 语句结束和下一条语句之间的时间是否具有确定性(与路径无关)
- 我可以在开关(消息)语句的同时运行一段时间吗?(C )
- 如何从一段时间返回继续
- MFC:在 CRichEditCtrl 中突出显示一条线一段时间,然后恢复