CRichEditCtrl控件的使用方式 追加显示

常规的EDIT控件只能显示一行,当我们希望把所有的操作日志都显示出来,此时你应该选择RICHEDIT控件;

1、初始化此控件: AfxInitRichEdit2();

2、设置显示内容:用以下接口即可不断追加显示操作日志

bool PirntLog(char* pszLog)
{
       m_ctrlRichShow.ReplaceSel(pszLog);//追加显示的内容
       return true;
}

注意:

①、在输入参数pszLog参数后添加\n换行符,输入的显示会自动换行;
②、设置控件属性可以垂直拉动,vertical scroll =True即可上下拉动显示全部内容;

 

ReplaceSel接口的解释:

 

CRichEditCtrl::ReplaceSel

void ReplaceSel( LPCTSTR lpszNewText, BOOL bCanUndo = FALSE );

Parameters

lpszNewText

Pointer to a null-terminated string containing the replacement text.

bCanUndo

To specify that this function can be undone, set the value of this parameter toTRUE. The default value is FALSE.

Remarks

Call this function to replace the current selection in this CRichEditCtrl object with the specified text. To replace all the text in thisCRichEditCtrl object, use CWnd::SetWindowText.

If there is no current selection, the replacement text is inserted at the insertion point, that is, the current caret location.

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值