void Function1() { // pRichEdit - Object of the CRichEditCtrl PARAFORMAT para1; para1.dwMask = PFM_ALIGNMENT ; para1.wAlignment = ( WORD ) PFA_LEFT; pRichEdit->SetParaFormat( para1 ); AppendData(_T("1234S")); PARAFORMAT para2; para2.dwMask = PFM_ALIGNMENT ; para2.wAlignment = ( WORD ) PFA_CENTER; pRichEdit->SetParaFormat( para2 ); AppendData(_T("\r\n123456ffffffffffKKS")); } void AppendData(CString data) { //data - text to append with the CRichEditCtrl's text int nBegin; nBegin = pRichEdit->GetTextLength(); pRichEdit->SetSel(nBegin, nBegin); // Select last character pRichEdit->ReplaceSel(data); // Append, move cursor to end of text pRichEdit->SetSel(-1,0); // Remove Black selection bars nBegin = pRichEdit->GetTextLength(); // Get New Length pRichEdit->SetSel(nBegin,nBegin); // Cursor to End of new text }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)