<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[RichEdit 2.0 Inhalt Formatieren]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>mal ne Frage, ich versuche den Inhalt eines RichEdit 2.0 Control zu Formatieren.</p>
<pre><code class="language-cpp">CString m_strText = &quot;Das ist der der Text der Formatiert werden soll .....&quot;;
CString zeichen = &quot;&quot;;
m_AuthAnzeige.SetSel(-1,m_strAuthStand.GetLength()); // ist das RichEdit Control
for(int i = 0;i &lt; 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 = &quot;&quot;;
}
</code></pre>
<pre><code class="language-cpp">void CAuthBestaetigung::AddString(CString strToAdd, COLORREF &amp;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);     

}
</code></pre>
<p>Das Funktioniert zwar, ist aber bei längeren Text sau langsam...<br />
Ist das des weisheit letzter Schluß ??</p>
<p>Da muß es doch was anderes geben ??</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/82470/richedit-2-0-inhalt-formatieren</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 23:24:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/82470.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 11 Aug 2004 13:05:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to RichEdit 2.0 Inhalt Formatieren on Wed, 11 Aug 2004 13:05:09 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>mal ne Frage, ich versuche den Inhalt eines RichEdit 2.0 Control zu Formatieren.</p>
<pre><code class="language-cpp">CString m_strText = &quot;Das ist der der Text der Formatiert werden soll .....&quot;;
CString zeichen = &quot;&quot;;
m_AuthAnzeige.SetSel(-1,m_strAuthStand.GetLength()); // ist das RichEdit Control
for(int i = 0;i &lt; 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 = &quot;&quot;;
}
</code></pre>
<pre><code class="language-cpp">void CAuthBestaetigung::AddString(CString strToAdd, COLORREF &amp;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);     

}
</code></pre>
<p>Das Funktioniert zwar, ist aber bei längeren Text sau langsam...<br />
Ist das des weisheit letzter Schluß ??</p>
<p>Da muß es doch was anderes geben ??</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/579951</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/579951</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Wed, 11 Aug 2004 13:05:09 GMT</pubDate></item></channel></rss>