主题:CRichEdit字体颜色设置问题
m_text="";
m_text=m_text+"ABCDEFGHIUKKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEGHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBDBFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEFFFACCDDEAAAAAAAAAABDEAAAAAAAAAAAAAAAAAAAAAAAAA";
m_richedit.ReplaceSel(m_text);
CHARFORMAT cf;
ZeroMemory(&cf,sizeof(CHARFORMAT));
cf.cbSize=sizeof(CHARFORMAT);
cf.dwMask =CFM_COLOR|CFE_BOLD;
cf.dwEffects=CFE_BOLD;
cf.crTextColor=RGB(200,100,255);
m_richedit.SetSel(5 ,10);
m_richedit.SetSelectionCharFormat(cf);
我有个问题百思不得其解:当m_text被赋予的字符串少于等于255个字符时,5~10区域内的字符被正确着色,而当字符串大于255个字符时,5~10之间的区域没有任何变化,仿佛该函数m_richedit.SetSelectionCharFormat(cf);失效了,问题到底出在哪呢?该如何解决,请各位帮帮忙。
m_text=m_text+"ABCDEFGHIUKKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEGHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBDBFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEFFFACCDDEAAAAAAAAAABDEAAAAAAAAAAAAAAAAAAAAAAAAA";
m_richedit.ReplaceSel(m_text);
CHARFORMAT cf;
ZeroMemory(&cf,sizeof(CHARFORMAT));
cf.cbSize=sizeof(CHARFORMAT);
cf.dwMask =CFM_COLOR|CFE_BOLD;
cf.dwEffects=CFE_BOLD;
cf.crTextColor=RGB(200,100,255);
m_richedit.SetSel(5 ,10);
m_richedit.SetSelectionCharFormat(cf);
我有个问题百思不得其解:当m_text被赋予的字符串少于等于255个字符时,5~10区域内的字符被正确着色,而当字符串大于255个字符时,5~10之间的区域没有任何变化,仿佛该函数m_richedit.SetSelectionCharFormat(cf);失效了,问题到底出在哪呢?该如何解决,请各位帮帮忙。