CRichEditCtrl更改为BCGControlBar的CBCGPEdit

1.添加Edit控件,设置其属性

2.Button "Result" 的消息函数如下

int CTestMFC2Dlg::m_Count = 0;
void CTestMFC2Dlg::OnBnClickedButtonResult()
{
    // TODO: 在此添加控件通知处理程序代码
​
    LOGFONT lf;
​
    // clear out structure.
    memset(&lf, 0, sizeof(LOGFONT));
​
    // request a 12-pixel-height font
    lf.lfHeight = 90;
​
    // request a face name "Arial".
    _tcsncpy_s(lf.lfFaceName, LF_FACESIZE, _T("Arial"), 7);
​
    CClientDC dc(this);
​
    CFont outputFont;
    VERIFY(outputFont.CreatePointFontIndirect(&lf, &dc));
​
    richeditResult.SetModify(FALSE);
    richeditResult.SetFont(&outputFont,TRUE);
    richeditResult.SetWindowTextW(_T(""));
    richeditResult.SetSel(1, -1); 
​
    CString m_strResult;
    for(int i = m_Count; i<m_Count + 5 ; i++)
    {
        CString strNum = _T("");
​
        strNum.Format(_T("%d:"), i);
        m_strResult += strNum;
        m_strResult += _T("将剪贴板中的数据插入到当前光标位置的编辑控件中。");
        m_strResult += _T("\r\n\r\n");
    }
​
    richeditResult.ReplaceSel(m_strResult);
​
    m_Count+=5;
​
    outputFont.DeleteObject();
}

3.效果

4.完整的项目代码

链接:https://pan.baidu.com/s/1otwsRJ8bfn9BqzG0UEZPfw

提取码:efnh

文章转自:http://liyanliang.net/cricheditctrl%e6%9b%b4%e6%94%b9%e4%b8%babcgcontrolbar%e7%9a%84cbcgpedit/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值