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);
}
richedit添加两段颜色不同的文字
最新推荐文章于 2017-04-20 13:39:25 发布