如何在richedit控件上为任意制定文字修改颜色?OnCtlColor改的是这个控件内文字颜色,不行。
好像有种方法是根据显示区域重画指定文字,我测试了一下该控件自带的函数:
CHARFORMAT cfm, cfDefault;
cfm.cbSize=sizeof(cfm);
cfm.bCharSet=GB2312_CHARSET;
cfm.crTextColor=RGB(200,200,0);
cfm.dwMask=CFM_CHARSET | CFM_COLOR ;
m_rich1.SetDefaultCharFormat(cfm);
MSDN里说用这种方法可以改变文字颜色,但我在2K SERVER下却没看到效果?
(字体效果倒是出来了)请问哪位朋友作过类似的咚咚,给点提示;)感谢!!
好像有种方法是根据显示区域重画指定文字,我测试了一下该控件自带的函数:
CHARFORMAT cfm, cfDefault;
cfm.cbSize=sizeof(cfm);
cfm.bCharSet=GB2312_CHARSET;
cfm.crTextColor=RGB(200,200,0);
cfm.dwMask=CFM_CHARSET | CFM_COLOR ;
m_rich1.SetDefaultCharFormat(cfm);
MSDN里说用这种方法可以改变文字颜色,但我在2K SERVER下却没看到效果?
(字体效果倒是出来了)请问哪位朋友作过类似的咚咚,给点提示;)感谢!!
memset(&cfDefault,0,sizeof(cfDefault));
cfDefault.cbSize=sizeof(cfDefault);
cfDefault.dwMask = CFM_FACE | CFM_SIZE |CFM_CHARSET | CFM_SPACING;
cfDefault.yHeight = 200;
cfDefault.bCharSet =ARABIC_CHARSET; //
strcpy(cfDefault.szFaceName,"Arial");
m_RInput.SetDefaultCharFormat(cfDefault);
也就是我上面的
cfDefault.dwMask = CFM_FACE | CFM_SIZE |CFM_CHARSET | CFM_SPACING;
Members containing valid information or attributes to set. This member can be zero, one, or more than one of the following values. Value Meaning
CFM_BOLD The CFE_BOLD value of the dwEffects member is valid.
CFM_CHARSET The bCharSet member is valid.
CFM_COLOR The crTextColor member and the CFE_AUTOCOLOR value of the dwEffects member are valid.
CFM_FACE The szFaceName member is valid.
CFM_ITALIC The CFE_ITALIC value of the dwEffects member is valid.
CFM_OFFSET The yOffset member is valid.
CFM_PROTECTED The CFE_PROTECTED value of the dwEffects member is valid.
CFM_SIZE The yHeight member is valid.
CFM_STRIKEOUT The CFE_STRIKEOUT value of the dwEffects member is valid.
CFM_UNDERLINE. The CFE_UNDERLINE value of the dwEffects member is valid.