<?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[Clistctrl und Bitmap aus der FAQ]]></title><description><![CDATA[<p>Hallo<br />
Ich habe aus der FAQ dieses Beispiel gefunden.<br />
ich habe ein Dialog mit List Controll und Button angelegt.<br />
Das Bild wird auch richtig geladen,aber nicht angezeigt.<br />
Angezeigt wird nur dies &quot;Bitmap&quot; von ganz unten.</p>
<p>Hat jemand eine Idee</p>
<pre><code class="language-cpp">void CLControlDlg::OnBnClickedButton1()
{
int size = 96;
CBitmap bitmap,bit; // Hier werden zwei variablen vom Typ CBitmap erzeugt. &quot;bitmap&quot; ist das quell- und &quot;bit&quot; das zielbitmap, was letzlich angezeigt wird.
BITMAP bm;			//das ist um die größe des Quellbitmap herauszubekommen.
bitmap.Attach(LoadImage(NULL,&quot;c:\\g.bmp&quot;,IMAGE_BITMAP,NULL,NULL,LR_LOADFROMFILE|LR_DEFAULTCOLOR|LR_DEFAULTSIZE));
//bitmap.LoadBitmap(IDB_BIT);
bitmap.GetObject(sizeof(bm), &amp;bm);
{
        CDC speicherDC;
        speicherDC.CreateCompatibleDC(GetDC());
        speicherDC.SelectObject(&amp;bitmap);
        //so hier wird der Gerätekontex für das quellbitmap erzeugt.
        CDC BmpDC;
        BmpDC.CreateCompatibleDC(GetDC());
        bit.CreateCompatibleBitmap(GetDC(),size,size); //mit CreateCompatibleBitmap erzeugen wir ein bitmap aus einem Gerätekontex. In diesem fall ist das BmpDC
        BmpDC.SelectObject(&amp;bit);
        //hier wird der Gerätekontex für das zielbitmap erzeugt.
        BmpDC.SetStretchBltMode(HALFTONE);
        ::SetBrushOrgEx(BmpDC.m_hDC ,0,0,NULL);
        //die beiden zeilen sind wichtig weil das bild sonst net in den richtigen farben angezeigt wird. Was sie machen weis ich net, dEUs muss mal erklären ;)
        BmpDC.StretchBlt(0, 0,size,size,&amp;speicherDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
 }
//Ich denke mal das ich zu hier unten nix sagen muss
CImageList m_ImageList;
m_ImageList.Create(size,size,ILC_COLOR24,1,1);
m_ImageList.Add(&amp;bit , RGB(0,0,0));
CListCtrl * pListCtrl = (CListCtrl*) GetDlgItem(IDC_LIST1);
pListCtrl-&gt;SetImageList(&amp;m_ImageList,LVSIL_NORMAL);
pListCtrl-&gt;InsertItem(0,&quot;Bitmap&quot;,0);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/140138/clistctrl-und-bitmap-aus-der-faq</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Jul 2026 12:16:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/140138.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 12 Mar 2006 14:44:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Clistctrl und Bitmap aus der FAQ on Sun, 12 Mar 2006 14:44:59 GMT]]></title><description><![CDATA[<p>Hallo<br />
Ich habe aus der FAQ dieses Beispiel gefunden.<br />
ich habe ein Dialog mit List Controll und Button angelegt.<br />
Das Bild wird auch richtig geladen,aber nicht angezeigt.<br />
Angezeigt wird nur dies &quot;Bitmap&quot; von ganz unten.</p>
<p>Hat jemand eine Idee</p>
<pre><code class="language-cpp">void CLControlDlg::OnBnClickedButton1()
{
int size = 96;
CBitmap bitmap,bit; // Hier werden zwei variablen vom Typ CBitmap erzeugt. &quot;bitmap&quot; ist das quell- und &quot;bit&quot; das zielbitmap, was letzlich angezeigt wird.
BITMAP bm;			//das ist um die größe des Quellbitmap herauszubekommen.
bitmap.Attach(LoadImage(NULL,&quot;c:\\g.bmp&quot;,IMAGE_BITMAP,NULL,NULL,LR_LOADFROMFILE|LR_DEFAULTCOLOR|LR_DEFAULTSIZE));
//bitmap.LoadBitmap(IDB_BIT);
bitmap.GetObject(sizeof(bm), &amp;bm);
{
        CDC speicherDC;
        speicherDC.CreateCompatibleDC(GetDC());
        speicherDC.SelectObject(&amp;bitmap);
        //so hier wird der Gerätekontex für das quellbitmap erzeugt.
        CDC BmpDC;
        BmpDC.CreateCompatibleDC(GetDC());
        bit.CreateCompatibleBitmap(GetDC(),size,size); //mit CreateCompatibleBitmap erzeugen wir ein bitmap aus einem Gerätekontex. In diesem fall ist das BmpDC
        BmpDC.SelectObject(&amp;bit);
        //hier wird der Gerätekontex für das zielbitmap erzeugt.
        BmpDC.SetStretchBltMode(HALFTONE);
        ::SetBrushOrgEx(BmpDC.m_hDC ,0,0,NULL);
        //die beiden zeilen sind wichtig weil das bild sonst net in den richtigen farben angezeigt wird. Was sie machen weis ich net, dEUs muss mal erklären ;)
        BmpDC.StretchBlt(0, 0,size,size,&amp;speicherDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
 }
//Ich denke mal das ich zu hier unten nix sagen muss
CImageList m_ImageList;
m_ImageList.Create(size,size,ILC_COLOR24,1,1);
m_ImageList.Add(&amp;bit , RGB(0,0,0));
CListCtrl * pListCtrl = (CListCtrl*) GetDlgItem(IDC_LIST1);
pListCtrl-&gt;SetImageList(&amp;m_ImageList,LVSIL_NORMAL);
pListCtrl-&gt;InsertItem(0,&quot;Bitmap&quot;,0);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1014595</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1014595</guid><dc:creator><![CDATA[bingo]]></dc:creator><pubDate>Sun, 12 Mar 2006 14:44:59 GMT</pubDate></item><item><title><![CDATA[Reply to Clistctrl und Bitmap aus der FAQ on Mon, 13 Mar 2006 10:46:24 GMT]]></title><description><![CDATA[<p>Kann hier keiner helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1015128</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1015128</guid><dc:creator><![CDATA[Bingo]]></dc:creator><pubDate>Mon, 13 Mar 2006 10:46:24 GMT</pubDate></item><item><title><![CDATA[Reply to Clistctrl und Bitmap aus der FAQ on Wed, 15 Mar 2006 20:48:54 GMT]]></title><description><![CDATA[<p>Schupps <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1017158</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017158</guid><dc:creator><![CDATA[Bingo]]></dc:creator><pubDate>Wed, 15 Mar 2006 20:48:54 GMT</pubDate></item><item><title><![CDATA[Reply to Clistctrl und Bitmap aus der FAQ on Thu, 16 Mar 2006 05:52:57 GMT]]></title><description><![CDATA[<p>Erstma bist du sicher das du im ListCtrl den entsprechenden style benutzt das klappt nähmlich net mit Report.Und vor allem is es auch nen ListCtrl oda nur ne ListBox?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1017230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1017230</guid><dc:creator><![CDATA[xyz44]]></dc:creator><pubDate>Thu, 16 Mar 2006 05:52:57 GMT</pubDate></item></channel></rss>