A
Hallo Leute,
mal ne Frage, ich versuche den Inhalt eines RichEdit 2.0 Control zu Formatieren.
CString m_strText = "Das ist der der Text der Formatiert werden soll .....";
CString zeichen = "";
m_AuthAnzeige.SetSel(-1,m_strAuthStand.GetLength()); // ist das RichEdit Control
for(int i = 0;i < m_strTex.GetLength(); i++)
{
zeichen = m_m_strTex[i];
int zaehler = i;
if(zaehler%2 == 1)
{
COLORREF crText = RGB(255,0,0);
AddString(zeichen,crText,TRUE);
m_AuthAnzeige.ReplaceSel(zeichen, TRUE);
}
else
{
COLORREF crText = RGB(0,0,0);
AddString(zeichen,crText,TRUE);
m_AuthAnzeige.ReplaceSel(zeichen, TRUE);
}
zeichen = "";
}
void CAuthBestaetigung::AddString(CString strToAdd, COLORREF &crNewColor, bool bBold)
{
CHARFORMAT cf;
cf.cbSize = sizeof(CHARFORMAT);
cf.dwMask = CFM_COLOR | CFM_UNDERLINE | CFM_BOLD;
cf.dwEffects =(unsigned long) ~( CFE_AUTOCOLOR | CFE_UNDERLINE | CFE_BOLD);
if(bBold)
cf.dwEffects|=CFE_BOLD;
cf.crTextColor = crNewColor;
int iEndPos = m_AuthAnzeige.GetWindowTextLength();
// m_AuthAnzeige.SetSel(iStartPos, iEndPos);
m_AuthAnzeige.SetSel(-1, iEndPos);
m_AuthAnzeige.SetSelectionCharFormat(cf);
m_AuthAnzeige.HideSelection(TRUE, FALSE);
}
Das Funktioniert zwar, ist aber bei längeren Text sau langsam...
Ist das des weisheit letzter Schluß ??
Da muß es doch was anderes geben ??
Gruß
andy_mann