多行编辑框控件里的内容如何做到每一行字体颜色不同??? 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /*-============================================================== * 增加命令提示,并将控件中的文字总数取得,以便后来确定只读的区域 * str为在CommandEdit控件中的提示语句 * bBold 判断显示的字是否为加粗 * clr 为新增加的字使用什么颜色 * =================================================================*/void CVSCommandEdit::AddText(CString str,BOOL bBold,COLORREF clr){ //str = "\n" + str; LONG nStart,nEnd; //插入传入的字符串 this->SetSel(0,-1); this->GetSel(nStart,nEnd); this->SetSel(nEnd,nEnd + 1); this->ReplaceSel(str); int nLen = str.GetLength(); SetSel(nEnd - 1,nEnd + nLen); DWORD dwEffects = bBold ? CFE_BOLD : 0; CHARFORMAT2 cfm; cfm.cbSize = sizeof(cfm); cfm.dwEffects = CFE_BOLD; cfm.crTextColor = clr; //设置字高 // cfm.wWeight = 22; // cfm.yHeight = 196; // cfm.dwMask = bBold ? (CFM_BOLD | CFM_COLOR | CFM_SIZE | CFM_WEIGHT) : CFM_COLOR | CFM_SIZE | CFM_WEIGHT; cfm.dwMask = bBold ? (CFM_BOLD | CFM_COLOR) : CFM_COLOR; SetSelectionCharFormat(cfm); this->SetSel(0,-1); this->GetSel(this->m_crReadOnlyPos.cpMin,this->m_crReadOnlyPos.cpMax); this->m_crReadOnlyPos.cpMax -= 1; this->SetSel(this->m_crReadOnlyPos.cpMax + 1,-1); this->EnableScrollBar(SB_BOTH,ESB_DISABLE_BOTH);} MFC下读写文件然后用RC4算法加密的程序有Bug ,请大牛看一下。有偿。麻烦尽快回复。 编译错误?请个人帮忙看看! 听听大家的意见 错误:'CRecordset' : base class undefined 简单。到微软哪里去查Q196342这样的问题代号 怎么用OLE的拖放做一个程序的自拖放自接收? 如何CDocument发送自定义消息?? 请问: 如何定制像Peeper地菜单? 呵呵~~,问个很菜的:) com中接口调用的问题,急。 问个runtime error的问题,请各位强人指点 怎么捕获非标准usb设备插入或拔出消息?
* 增加命令提示,并将控件中的文字总数取得,以便后来确定只读的区域
* str为在CommandEdit控件中的提示语句
* bBold 判断显示的字是否为加粗
* clr 为新增加的字使用什么颜色
* =================================================================*/
void CVSCommandEdit::AddText(CString str,BOOL bBold,COLORREF clr)
{
//str = "\n" + str;
LONG nStart,nEnd;
//插入传入的字符串
this->SetSel(0,-1);
this->GetSel(nStart,nEnd);
this->SetSel(nEnd,nEnd + 1);
this->ReplaceSel(str);
int nLen = str.GetLength();
SetSel(nEnd - 1,nEnd + nLen); DWORD dwEffects = bBold ? CFE_BOLD : 0;
CHARFORMAT2 cfm;
cfm.cbSize = sizeof(cfm);
cfm.dwEffects = CFE_BOLD;
cfm.crTextColor = clr;
//设置字高
// cfm.wWeight = 22;
// cfm.yHeight = 196;
// cfm.dwMask = bBold ? (CFM_BOLD | CFM_COLOR | CFM_SIZE | CFM_WEIGHT) : CFM_COLOR | CFM_SIZE | CFM_WEIGHT;
cfm.dwMask = bBold ? (CFM_BOLD | CFM_COLOR) : CFM_COLOR;
SetSelectionCharFormat(cfm); this->SetSel(0,-1);
this->GetSel(this->m_crReadOnlyPos.cpMin,this->m_crReadOnlyPos.cpMax);
this->m_crReadOnlyPos.cpMax -= 1;
this->SetSel(this->m_crReadOnlyPos.cpMax + 1,-1);
this->EnableScrollBar(SB_BOTH,ESB_DISABLE_BOTH);
}