<?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[TreeView soll Icon enthalten]]></title><description><![CDATA[<p>Hi,</p>
<p>ich brauche eure Hilfe beim Einfügen eines Icons in<br />
mein TreeView.<br />
Ich habe leider keine Ahnung wie ich dem TreeView-Eintrag<br />
Icons voranstellen kann.</p>
<p>Hier mein Code für das TreeView:</p>
<pre><code class="language-cpp">HTREEITEM hti1= NULL;
hti1 = m_cTree.InsertItem(&quot;1.Eintrag&quot;);
m_cTree.InsertItem(&quot;1.1 Eintrag&quot;, hti1);
m_cTree.InsertItem(&quot;1.2 Eintrag&quot;, hti1);
m_cTree.InsertItem(&quot;1.3 Eintrag&quot;, hti1);
m_cTree.InsertItem(&quot;1.4 Eintrag&quot;, hti1);

hti1 = m_cTree.InsertItem(&quot;3.Eintrag&quot;);
m_cTree.InsertItem(&quot;3.1 Eintrag&quot;, hti1);
</code></pre>
<p>Ich glaube ich muss SetIcon verwenden, aber wie mache ich das ?!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/74361/treeview-soll-icon-enthalten</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 11:13:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/74361.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 May 2004 17:15:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TreeView soll Icon enthalten on Wed, 19 May 2004 17:15:16 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich brauche eure Hilfe beim Einfügen eines Icons in<br />
mein TreeView.<br />
Ich habe leider keine Ahnung wie ich dem TreeView-Eintrag<br />
Icons voranstellen kann.</p>
<p>Hier mein Code für das TreeView:</p>
<pre><code class="language-cpp">HTREEITEM hti1= NULL;
hti1 = m_cTree.InsertItem(&quot;1.Eintrag&quot;);
m_cTree.InsertItem(&quot;1.1 Eintrag&quot;, hti1);
m_cTree.InsertItem(&quot;1.2 Eintrag&quot;, hti1);
m_cTree.InsertItem(&quot;1.3 Eintrag&quot;, hti1);
m_cTree.InsertItem(&quot;1.4 Eintrag&quot;, hti1);

hti1 = m_cTree.InsertItem(&quot;3.Eintrag&quot;);
m_cTree.InsertItem(&quot;3.1 Eintrag&quot;, hti1);
</code></pre>
<p>Ich glaube ich muss SetIcon verwenden, aber wie mache ich das ?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/523595</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523595</guid><dc:creator><![CDATA[Chris1986]]></dc:creator><pubDate>Wed, 19 May 2004 17:15:16 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView soll Icon enthalten on Wed, 19 May 2004 17:45:22 GMT]]></title><description><![CDATA[<pre><code>CImageList list;
	list.Create(16,16,ILC_COLOR,1,0); 
	list.Add(AfxGetApp()-&gt;LoadIcon(IDI_ICON1));
	list.Add(AfxGetApp()-&gt;LoadIcon(IDI_ICON2));
	list.Add(AfxGetApp()-&gt;LoadIcon(IDI_ICON3));
	GetTreeCtrl().SetImageList(&amp;list,TVSIL_NORMAL);
	GetTreeCtrl().InsertItem(&quot;item1&quot;,1/*normales icon bzw. position in der imagelist*/,1/*icon wenn es angeklickt wird*/,hitem/*das eigentliche item*/);
</code></pre>
<p>Devil</p>
]]></description><link>https://www.c-plusplus.net/forum/post/523610</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523610</guid><dc:creator><![CDATA[phlox81]]></dc:creator><pubDate>Wed, 19 May 2004 17:45:22 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView soll Icon enthalten on Wed, 19 May 2004 18:44:20 GMT]]></title><description><![CDATA[<p>Hi devil81,</p>
<p>vielen Dank für deine Antwort <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Ich habe das nun so eingebaut in OnInitDialog:</p>
<pre><code class="language-cpp">CImageList list; 
    list.Create(16,16,ILC_COLOR,1,0); 
    list.Add(AfxGetApp()-&gt;LoadIcon(IDI_ICON1)); 
    list.Add(AfxGetApp()-&gt;LoadIcon(IDI_ICON2)); 
    list.Add(AfxGetApp()-&gt;LoadIcon(IDI_ICON3)); 
    m_cTree.SetImageList(&amp;list,LVSIL_NORMAL); 

hti1 = m_cTree.InsertItem(&quot;1.Eintrag&quot;);
m_cTree.InsertItem(&quot;1.0 Eintrag&quot;,1,1,hti1);//hier soll ein Icon hin ;-)
m_cTree.InsertItem(&quot;1.1 Eintrag&quot;,hti1);
</code></pre>
<p>Das Ergebnis ist allerdings, dass ich das Icon nicht sehe,<br />
sondern nun einfach einen leeren Raum zwischen der Stammlinie und<br />
dem Text habe.</p>
<p>Was mache ich falsch ? Habe die Icon auf 16x16 in 16/256/Monochrom bereits<br />
in jeder denklichen Form angelegt.</p>
<p>Danke<br />
Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/523640</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523640</guid><dc:creator><![CDATA[Chris1986]]></dc:creator><pubDate>Wed, 19 May 2004 18:44:20 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView soll Icon enthalten on Wed, 19 May 2004 20:35:24 GMT]]></title><description><![CDATA[<p>Es Fehlt wohl noch ein:<br />
GetTreeCtrl().ModifyStyle(NULL,TVS_HASBUTTONS |TVS_LINESATROOT | TVS_HASLINES)</p>
<p>Dann sollte es klappen.</p>
<p>Devil</p>
]]></description><link>https://www.c-plusplus.net/forum/post/523686</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523686</guid><dc:creator><![CDATA[phlox81]]></dc:creator><pubDate>Wed, 19 May 2004 20:35:24 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView soll Icon enthalten on Wed, 19 May 2004 20:46:59 GMT]]></title><description><![CDATA[<p>Hi again,</p>
<p>ich habe es so versucht. Das Ergebnis ist leider das gleiche<br />
(leeres 16x16-Feld vor jedem Eintrag).</p>
<pre><code class="language-cpp">m_cTree.ModifyStyle(NULL,TVS_HASBUTTONS |TVS_LINESATROOT|TVS_HASLINES);
</code></pre>
<p>Auch in einem neuen Projekt das gleiche Ergebnis.<br />
Du schreibst &quot;GetTreeCtrl()&quot; und ich habe die Membervariable<br />
m_cTree an diese Stelle gesetzt, daran kann es doch wohl net liegen ?!<br />
Sonst habe ich alles 1 zu 1 übernommen.</p>
<p>Gruß<br />
Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/523694</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523694</guid><dc:creator><![CDATA[Chris1986]]></dc:creator><pubDate>Wed, 19 May 2004 20:46:59 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView soll Icon enthalten on Wed, 19 May 2004 22:14:06 GMT]]></title><description><![CDATA[<p>Hm, also ich kopiere den Code aus einem CTreeView,<br />
welcher ein CTreeCtrl als View implementiert.</p>
<p>Hab aber gerade den Fehler gefunden.</p>
<p>Das Problem ist, das wenn CImageList nur in der Funktion<br />
deklariert wird, sie nach der Funktion auch brav zerstört wird.<br />
Du musst also deinem Dialog (oder Treeklasse) eine Membervariable<br />
vom Typ CImageList geben.</p>
<p>Devil</p>
]]></description><link>https://www.c-plusplus.net/forum/post/523742</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523742</guid><dc:creator><![CDATA[phlox81]]></dc:creator><pubDate>Wed, 19 May 2004 22:14:06 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView soll Icon enthalten on Wed, 19 May 2004 22:39:12 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>also ich habe CImageList list; bereits global erstellt.<br />
Das Problem bleibt leider bestehen.<br />
Bin schon halb durch google durch <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f622.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--crying_face"
      title=";-("
      alt="😢"
    /><br />
Läuft das ganze bei dir ?</p>
<p>Thx für deine Bemühungen,<br />
Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/523747</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523747</guid><dc:creator><![CDATA[Chris1986]]></dc:creator><pubDate>Wed, 19 May 2004 22:39:12 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView soll Icon enthalten on Wed, 19 May 2004 22:56:29 GMT]]></title><description><![CDATA[<p>Ich habs jetzt extra in nem Testprojekt ausprobiert.<br />
Die Icons sind bei dir auch in den Resourcen erstellt ? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Mein Code:</p>
<pre><code>HTREEITEM hti1;

    list.Create(16,16,ILC_COLOR,1,0);
    list.Add(AfxGetApp()-&gt;LoadIcon(IDI_ICON1));
    m_tree.SetImageList(&amp;list,LVSIL_NORMAL);

hti1 = m_tree.InsertItem(&quot;1.Eintrag&quot;,1,1);
m_tree.InsertItem(&quot;1.0 Eintrag&quot;,0,0,hti1);//hier soll ein Icon hin ;-)
m_tree.InsertItem(&quot;1.1 Eintrag&quot;,hti1);
m_tree.ModifyStyle(NULL,TVS_HASBUTTONS |TVS_LINESATROOT|TVS_HASLINES);
</code></pre>
<p>Devil</p>
]]></description><link>https://www.c-plusplus.net/forum/post/523750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523750</guid><dc:creator><![CDATA[phlox81]]></dc:creator><pubDate>Wed, 19 May 2004 22:56:29 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView soll Icon enthalten on Wed, 19 May 2004 23:03:50 GMT]]></title><description><![CDATA[<p>Hi devil,</p>
<p>also ich habe keine Ahnung wie oder warum, aber<br />
ES GEHT plötzlich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";-)"
      alt="😉"
    /> Ich bin begeistert.<br />
Nach dem 5ten Projekt und null Änderungen<br />
an deinem Code...???</p>
<p>Nach der schweren Geburt hat sich deine Lösung<br />
mindestens einen Eintrag in den FAQ verdient *Antrag stell*<br />
Und ich schulde dir ein virtuelles Bier :-))</p>
<p>Thx a lot<br />
Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/523752</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523752</guid><dc:creator><![CDATA[Chris1986]]></dc:creator><pubDate>Wed, 19 May 2004 23:03:50 GMT</pubDate></item></channel></rss>