ReadEidt

12 篇文章 0 订阅
void CMyInfo2Dlg::OnButtonAppend() 
{
	// TODO: Add your control notification handler code here
	CString strOne = _T("Left is what you can make it, so try to make it beautiful!");
	CString strTwo = _T("Things can only get better!");
	static int times = 0;
	CString strMsg = _T("");
		
    // Initialize character format structure  	
	CHARFORMAT cf;  
    m_reditInfo.GetSelectionCharFormat(cf);  

    static int iHeight = 200;  
    cf.cbSize = sizeof(CHARFORMAT);  
    cf.dwMask |= CFM_BOLD;  
    cf.dwEffects |= CFE_BOLD;//设置粗体,取消用cf.dwEffects&=~CFE_BOLD;  
    cf.dwEffects &= ~CFE_AUTOCOLOR;  
    cf.dwMask |= CFM_COLOR;  
    cf.crTextColor = RGB(255, 0, 0);  
    cf.dwMask|= CFM_SIZE;  
    cf.yHeight = iHeight;//设置高度  
    cf.dwMask |= CFM_FACE;  
    _tcscpy(cf.szFaceName ,_T("微软雅黑"));//设置字体  

	for (int i = 0; i < 1000; i++)
	{
		if (times++ % 2 == 0)
		{
			strMsg = strOne;
		}
		else
		{
			strMsg = strTwo;
		}

		int pos = m_reditInfo.GetWindowTextLength(); 	
		m_reditInfo.SetSel(pos, -1);   
		// Set the character format  
		m_reditInfo.SetSelectionCharFormat(cf);  

		//strMsg = CString::Format("%5d ", i) + strMsg + _T("\r\n");
		CString strIndex;
		strIndex.Format(_T("%5d: "), i);
		strMsg = strIndex + strMsg + _T("\r\n");
		m_reditInfo.ReplaceSel(strMsg);
		m_reditInfo.PostMessage(WM_VSCROLL, SB_BOTTOM, 0); // 滚动条滚动到最下方

		Sleep(200);
		
		UpdateData(FALSE);
	}

}

http://www.cnblogs.com/qq78292959/archive/2011/08/30/2160056.html

https://msdn.microsoft.com/en-us/library/windows/desktop/aa816369(v=vs.85).aspx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值