CRICHEDITCTRL 改变部分文字 颜色 !
CRICHEDITCTRL 改变部分文字 颜色 求助!!!CHARFORMAT cfpEdit (CRichEditCtrl*)m_ctrlInputTextpEdit-
CRICHEDITCTRL 改变部分文字 颜色 求助!!! CHARFORMAT cf; pEdit = (CRichEditCtrl*)m_ctrlInputText; pEdit->GetSelectionCharFormat(cf); cf.dwEffects &= ~CFE_AUTOCOLOR; cf.dwMask = CFM_COLOR; cf.crTextColor = col; pEdit->GetSel(nSelBegin, nSelEnd); if (nSelBegin == nSelEnd) { pEdit->SetSel(0, -1); } else { pEdit->SetSel(nSelBegin, nSelEnd); } pEdit->SetSelectionCharFormat(cf); 单步调试中 SetSel()输入没有问题,但就是改变不了 文字颜色, 只有选择 第一行时 全文颜色改变 高手给看下哪里出了问题。。。 [最优解释] CHARFORMAT cf; memset(&cf,0,sizeof(cf)); cf.dwMask = CFM_COLOR; cf.crTextColor = col; ... 另外 WordWrap选择None[其他解释] 以前做过的,貌似忘了,MARK一下[其他解释] 难道是 setsel 第二个参数 大于 oxff 时 就失败?[其他解释] 来人啊, 昨天的问题,到今天都木有人回答么?[其他解释] 具体问题是 当setsel(start, end)中 end超过0xff 时,设定失败[其他解释]
引用: CHARFORMAT cf; memset(&cf,0,sizeof(cf)); cf.dwMask = CFM_COLOR; cf.crTextColor = col; ... 另外 WordWrap选择None 在哪儿让wordwrap选择none , 能具体点么?
[其他解释] 如果是CRichEditCtrl在控件,在resource中编辑属性
SDK的EM_SETWORDWRAPMODE也可以
如果是CRichEditView,m_nWordWrap可以设置
[其他解释] 引用: 如果是CRichEditCtrl在控件,在resource中编辑属性 SDK的EM_SETWORDWRAPMODE也可以 如果是CRichEditView,m_nWordWrap可以设置 还是不行啊, 具体问题还是 当setsel(start, end)中 end超过 0xff 时,设定失败, 但是只要 end< OXff,一切OK 。。。
[其他解释] else
{
pEdit->SetSel(nSelBegin, nSelEnd);
}
去掉看看
[其他解释] 引用: else { pEdit->SetSel(nSelBegin, nSelEnd); } 去掉看看 去掉也不行, 只要 end超过 OXff 就设定不成功
[其他解释] The return value is a zero-based value with the starting position of the selection in the low-order word and the position of the first character after the last selected character in the high-order word. If either of these values exceeds 65,535, the return value is –1.
这个是Edit的,Rich Edit的没有提
用SDK看看