|
-
February 23rd, 2008, 01:01 PM
#1
Text turns to mush
I am using this code to print color text to a rich edit box:
Code:
void CRichEditDlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
CHARFORMAT Cfm;
m_Richer.GetSelectionCharFormat(Cfm);
Cfm.cbSize = sizeof(CHARFORMAT);
Cfm.dwMask = CFM_COLOR|CFM_BOLD;
Cfm.dwEffects = CFE_BOLD;
Cfm.crTextColor = RGB(0,0,255);
m_Richer.SetSelectionCharFormat(Cfm);
CString text = "Now is the time for all good men to come to the aid of the party";
SETTEXTEX SetTextEx;
SetTextEx.codepage = CP_ACP;
SetTextEx.flags = ST_SELECTION;
m_Richer.SetSel(-1,-1);
m_Richer.SendMessage(EM_SETTEXTEX,(WPARAM)&SetTextEx, (LPARAM) (LPCTSTR)text);
}
Everything works well, the text prints to the box and the colors are correct, but when I scroll up or down using the thumb, all the text gets distorted. Any ideas?
Thanks
Zapper222
Last edited by zapper222; February 24th, 2008 at 10:47 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|