<?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[Button-Farbe ändern]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wüsste gerne, ob und wenn ja, wie ich die Farbe eines Buttons in MFC ändern<br />
kann...<br />
Ich kenne nur die Möglichkeit, die Hintergrundfarbe des Dialogs zu ändern.</p>
<p><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="😃"
    /> Gruss &amp; Merci</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/44253/button-farbe-ändern</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 06:32:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/44253.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 29 Jul 2003 13:40:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Button-Farbe ändern on Tue, 29 Jul 2003 13:40:58 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wüsste gerne, ob und wenn ja, wie ich die Farbe eines Buttons in MFC ändern<br />
kann...<br />
Ich kenne nur die Möglichkeit, die Hintergrundfarbe des Dialogs zu ändern.</p>
<p><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="😃"
    /> Gruss &amp; Merci</p>
]]></description><link>https://www.c-plusplus.net/forum/post/320339</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/320339</guid><dc:creator><![CDATA[chaos.sb]]></dc:creator><pubDate>Tue, 29 Jul 2003 13:40:58 GMT</pubDate></item><item><title><![CDATA[Reply to Button-Farbe ändern on Tue, 29 Jul 2003 13:50:16 GMT]]></title><description><![CDATA[<p>Den hintergrund kannst über die WM_CTLCOLORBTN bemhalen, wenn du mehr willst als nur den hintergrund, fange die WM_DRAWITEM ab und las deiner künstlerischen Ader freien lauf <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/320346</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/320346</guid><dc:creator><![CDATA[CMatt]]></dc:creator><pubDate>Tue, 29 Jul 2003 13:50:16 GMT</pubDate></item><item><title><![CDATA[Reply to Button-Farbe ändern on Tue, 29 Jul 2003 14:39:24 GMT]]></title><description><![CDATA[<p>Ich bin im Klassenassistenten auf meinen Button und hab ihm WM_DRAWITEM hinzugefügt.<br />
Das schaut bei mir so aus:</p>
<pre><code class="language-cpp">void Cclass_2_login::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemstruct)
{
//TODO
CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);

}
</code></pre>
<p>War das richtig? (Anmerkung: Ich hab leider keine Ahnung...)</p>
<p>Was muss ich weiter tun?</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /> thanks <a href="http://chaos.sb" rel="nofollow">chaos.sb</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/320382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/320382</guid><dc:creator><![CDATA[chaos.sb]]></dc:creator><pubDate>Tue, 29 Jul 2003 14:39:24 GMT</pubDate></item><item><title><![CDATA[Reply to Button-Farbe ändern on Tue, 29 Jul 2003 14:46:02 GMT]]></title><description><![CDATA[<p>Wie wars mit MSDN aufschlagen <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="😉"
    /><br />
Ist fast immer auch ein nettes Beispiel dabei wie z.B:</p>
<pre><code class="language-cpp">BOOL CALLBACK OwnDrawProc(HWND hDlg, UINT message, WPARAM wParam, 
                          LPARAM lParam) 
{ 
    HDC hdcMem; 
    LPDRAWITEMSTRUCT lpdis; 

    switch (message) 
    { 
        case WM_INITDIALOG: 

            // hinst, hbm1 and hbm2 are defined globally. 
            hbm1 = LoadBitmap((HANDLE) hinst, &quot;OwnBit1&quot;); 
            hbm2 = LoadBitmap((HANDLE) hinst, &quot;OwnBit2&quot;); 
            return TRUE; 

        case WM_DRAWITEM: 
            lpdis = (LPDRAWITEMSTRUCT) lParam; 
            hdcMem = CreateCompatibleDC(lpdis-&gt;hDC); 

            if (lpdis-&gt;itemState &amp; ODS_SELECTED)  // if selected 
                SelectObject(hdcMem, hbm2); 
            else 
                SelectObject(hdcMem, hbm1); 

            // Destination 
            StretchBlt( 
                lpdis-&gt;hDC,         // destination DC 
                lpdis-&gt;rcItem.left, // x upper left 
                lpdis-&gt;rcItem.top,  // y upper left 

                // The next two lines specify the width and 
                // height. 
                lpdis-&gt;rcItem.right - lpdis-&gt;rcItem.left, 
                lpdis-&gt;rcItem.bottom - lpdis-&gt;rcItem.top, 
                hdcMem,    // source device context 
                0, 0,      // x and y upper left 
                32,        // source bitmap width 
                32,        // source bitmap height 
                SRCCOPY);  // raster operation 

            DeleteDC(hdcMem); 
            return TRUE; 

        case WM_COMMAND: 
            if (wParam == IDOK 
                || wParam == IDCANCEL) 
            { 
                EndDialog(hDlg, TRUE); 
                return TRUE; 
            } 
            if (HIWORD(wParam) == BN_CLICKED) 
            { 
                switch (LOWORD(wParam)) 
                { 
                    case IDC_OWNERDRAW: 

                        // application-defined processing 

                        break; 
                } 
            } 
            break; 

        case WM_DESTROY: 
            DeleteObject(hbm1);  // delete bitmaps 
            DeleteObject(hbm2); 

            break; 

    } 
    return FALSE; 
        UNREFERENCED_PARAMETER(lParam); 
}
</code></pre>
<p>^^ Das verbaust du dann natlich MFC gerecht <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>
]]></description><link>https://www.c-plusplus.net/forum/post/320388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/320388</guid><dc:creator><![CDATA[CMatt]]></dc:creator><pubDate>Tue, 29 Jul 2003 14:46:02 GMT</pubDate></item></channel></rss>