richedit添加两段颜色不同的文字
2015-11-11 16:50
260 查看
void CWndDetail::AppendText(const CFString& strTime, const CFString& strContent) { CHARFORMAT2 cf; ::ZeroMemory(&cf, sizeof(CHARFORMAT2)); cf.cbSize = sizeof(CHARFORMAT2); cf.crTextColor = RGB(0xff,0,0); cf.dwMask = CFM_COLOR; CHARFORMAT2 cf1; ::ZeroMemory(&cf1, sizeof(CHARFORMAT2)); cf1.cbSize = sizeof(CHARFORMAT2); cf1.crTextColor = RGB(0,0,0); cf1.dwMask = CFM_COLOR; m_editHistory->AppendText("[ " + strTime + " ]"); int nLineCount = m_editHistory->GetLineCount(); m_editHistory->SetSel(m_editHistory->LineIndex(nLineCount - 1), -1); m_editHistory->SetSelectionCharFormat(cf); m_editHistory->AppendText("\n" + strContent + "\n\n"); m_editHistory->SetSel(m_editHistory->LineIndex(nLineCount), -1); m_editHistory->SetSelectionCharFormat(cf1); }
相关文章推荐
- Elasticsearch 全字段搜索_all,query_string查询,不进行分词
- Unix学习笔记------Stat函数与chmod函数的配合使用
- 学习wtl.1
- 最实用的APP界面设计知识,有温度的APP设计(转)
- 第六章家庭作业
- date详解
- 夺命雷公狗---Redis---1-Redis介绍
- misc笔记(更新中...)
- 通过RS232发送和接收短信(二)
- 第六章 注解式控制器详解(1)——跟着开涛学SpringMVC
- 常用SQL
- React-Native学习指南
- GUI(2) 迷宫问题
- 写的第一个接口的总结
- json的好处及用法
- linux 操作日记
- C# 文字转换最简单的方法
- ubuntu 操作日记
- 从零开始学习Node.js例子七 发送HTTP客户端请求并显示响应结果
- 用jQuery.form实现批量输入控件的提交