<?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[CTreeCtrl Problem!]]></title><description><![CDATA[<p>Hallo Forum,<br />
kann man die Rootitems von diesen CTreeCtrl Kontrolls farbig darstellen wenn sie<br />
unterelemente haben??<br />
Hat jemand so was schon gemacht!?</p>
<p>Ich hab versucht mit der ON_NOTIFY()</p>
<pre><code class="language-cpp">// in MessageMap
ON_NOTIFY(NM_CUSTOMDRAW, IDC_TREE1, OnCustomDraw)

//....

BOOL CWeb::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{

	NMLVCUSTOMDRAW* pLVCD = reinterpret_cast&lt;NMLVCUSTOMDRAW*&gt;( pNMHDR );

	*pResult = CDRF_DODEFAULT;
	CTreeCtrl* bItem = (CTreeCtrl *) pLVCD-&gt;nmcd.lItemlParam ;

	CString csItemText;
	switch (pLVCD-&gt;nmcd.dwDrawStage) 
	{
		case CDDS_PREPAINT :
			*pResult = CDRF_NOTIFYITEMDRAW  ;			
			break ;
		case CDDS_ITEMPREPAINT :

			if ( bItem ) // das ist Problem, ist immer NULL!!!! Warum??
			{

				pLVCD-&gt;clrTextBk = crBlau;
				pLVCD-&gt;clrText   = crGruen;

			}

			break ;
	}

	return TRUE;
}
</code></pre>
<p>Leider hab ich nie den Bezug auf das Control, ich möchte wenn dies weiter Unterelemente hat, z.B. Grün dargestellt wird, hier ist nur ein teil der Funktion<br />
um mein Versuch zu zeigen, was muß noch erweitert werden damit das funktioniert...</p>
<p>Danke<br />
pixel</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/147515/ctreectrl-problem</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 10:10:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/147515.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 17 May 2006 15:13:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CTreeCtrl Problem! on Wed, 17 May 2006 15:13:47 GMT]]></title><description><![CDATA[<p>Hallo Forum,<br />
kann man die Rootitems von diesen CTreeCtrl Kontrolls farbig darstellen wenn sie<br />
unterelemente haben??<br />
Hat jemand so was schon gemacht!?</p>
<p>Ich hab versucht mit der ON_NOTIFY()</p>
<pre><code class="language-cpp">// in MessageMap
ON_NOTIFY(NM_CUSTOMDRAW, IDC_TREE1, OnCustomDraw)

//....

BOOL CWeb::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{

	NMLVCUSTOMDRAW* pLVCD = reinterpret_cast&lt;NMLVCUSTOMDRAW*&gt;( pNMHDR );

	*pResult = CDRF_DODEFAULT;
	CTreeCtrl* bItem = (CTreeCtrl *) pLVCD-&gt;nmcd.lItemlParam ;

	CString csItemText;
	switch (pLVCD-&gt;nmcd.dwDrawStage) 
	{
		case CDDS_PREPAINT :
			*pResult = CDRF_NOTIFYITEMDRAW  ;			
			break ;
		case CDDS_ITEMPREPAINT :

			if ( bItem ) // das ist Problem, ist immer NULL!!!! Warum??
			{

				pLVCD-&gt;clrTextBk = crBlau;
				pLVCD-&gt;clrText   = crGruen;

			}

			break ;
	}

	return TRUE;
}
</code></pre>
<p>Leider hab ich nie den Bezug auf das Control, ich möchte wenn dies weiter Unterelemente hat, z.B. Grün dargestellt wird, hier ist nur ein teil der Funktion<br />
um mein Versuch zu zeigen, was muß noch erweitert werden damit das funktioniert...</p>
<p>Danke<br />
pixel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059656</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059656</guid><dc:creator><![CDATA[pixel]]></dc:creator><pubDate>Wed, 17 May 2006 15:13:47 GMT</pubDate></item><item><title><![CDATA[Reply to CTreeCtrl Problem! on Thu, 18 May 2006 06:31:00 GMT]]></title><description><![CDATA[<ol>
<li></li>
</ol>
<p>pixel schrieb:</p>
<blockquote>
<pre><code class="language-cpp">CTreeCtrl* bItem = (CTreeCtrl *) pLVCD-&gt;nmcd.lItemlParam ;
</code></pre>
</blockquote>
<p>Dieser cast ist unsinnig. Du mbekommst hier die Daten die im TVITEM::lParam eingetragen hast.</p>
<ol start="2">
<li></li>
</ol>
<p>pixel schrieb:</p>
<blockquote>
<pre><code class="language-cpp">NMLVCUSTOMDRAW* pLVCD = reinterpret_cast&lt;NMLVCUSTOMDRAW*&gt;( pNMHDR );
</code></pre>
</blockquote>
<p>Das ist ein Treeview und kein ListCtrl, also ist es eine NMTVCUSTOMDRAW!</p>
<p>Sieh DIr mal das Beispiel<br />
<a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;q248496" rel="nofollow">http://support.microsoft.com/default.aspx?scid=kb;EN-US;q248496</a><br />
an</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059923</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Thu, 18 May 2006 06:31:00 GMT</pubDate></item><item><title><![CDATA[Reply to CTreeCtrl Problem! on Fri, 19 May 2006 10:24:10 GMT]]></title><description><![CDATA[<p>Hallo,<br />
danke für den Link, erledigt! Zwar nicht ganz so wie in dem Beispiel aber es tut das was ich gewollt habe!<br />
Einzelnen Treeitems nach kriterien unterschiedliche Farben geben....</p>
<p>mfg<br />
pixel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1060778</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1060778</guid><dc:creator><![CDATA[pixel]]></dc:creator><pubDate>Fri, 19 May 2006 10:24:10 GMT</pubDate></item></channel></rss>