Problems encountered in changing a CRichEditCtrl selection color.
Posted
by dev ray
on Stack Overflow
See other posts from Stack Overflow
or by dev ray
Published on 2010-06-14T07:13:38Z
Indexed on
2010/06/14
11:32 UTC
Read the original article
Hit count: 223
visual-c++
|mfc
I have written the following code after creating the CRichEditCtrl
// 06112010 : The following code was added to highlight the textselection in black color instead of the default blue color of CRichEditCtrl. - 1311
{
m_EditControl.SetSel(0,100);
CHARFORMAT2 cf1;
cf1.cbSize = sizeof(CHARFORMAT2);
m_EditControl.GetSelectionCharFormat(cf1);
cf1.dwMask = CFM_BACKCOLOR ;
cf1.dwEffects &= ~CFE_AUTOBACKCOLOR;
cf1.crBackColor = RGB(0,0,0);
m_EditControl.SetSelectionCharFormat(cf1);
m_EditControl.Invalidate();
}
After this I am adding text, but the selection still comes in blue color instead of Black. Could someone please tell me what I am doing wrong?? Thanks, DeV
© Stack Overflow or respective owner