<?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[static: farben zur laufzeit ändern]]></title><description><![CDATA[<p>moin,</p>
<p>ich habe:</p>
<pre><code class="language-cpp">case WM_CTLCOLORSTATIC:
            SetBkMode ((HDC) wParam, TRANSPARENT);
            return (LRESULT)GetStockObject(NULL_BRUSH); // Hintergrund färben
        break;
</code></pre>
<p>nun möchte ich die Hintergrundfarbe/TextFarbe von einem Static ändern, zb über SendMessage(), doch welche message???</p>
<p>PS: es geht eigentlich um RadioFelder <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="😉"
    /> aber ist ja fast gleich</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/154407/static-farben-zur-laufzeit-ändern</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Jul 2026 13:35:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/154407.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Jul 2006 22:04:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to static: farben zur laufzeit ändern on Wed, 26 Jul 2006 22:04:07 GMT]]></title><description><![CDATA[<p>moin,</p>
<p>ich habe:</p>
<pre><code class="language-cpp">case WM_CTLCOLORSTATIC:
            SetBkMode ((HDC) wParam, TRANSPARENT);
            return (LRESULT)GetStockObject(NULL_BRUSH); // Hintergrund färben
        break;
</code></pre>
<p>nun möchte ich die Hintergrundfarbe/TextFarbe von einem Static ändern, zb über SendMessage(), doch welche message???</p>
<p>PS: es geht eigentlich um RadioFelder <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="😉"
    /> aber ist ja fast gleich</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1104972</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1104972</guid><dc:creator><![CDATA[knobbi]]></dc:creator><pubDate>Wed, 26 Jul 2006 22:04:07 GMT</pubDate></item><item><title><![CDATA[Reply to static: farben zur laufzeit ändern on Wed, 26 Jul 2006 22:43:10 GMT]]></title><description><![CDATA[<p>omg, hatten wir doch schon...Also:</p>
<pre><code class="language-cpp">LRESULT CALLBACK WndProc(...)
{
   static HBRUSH hbStatichBk;

   switch(uiMessage)
   {
      case WM_CREATE:
          hbStatichBk = CreateSolidBrush(RGB(rot,blau,grün));
          // ...

     case WM_CTLCOLORSTATIC: // oder WM_CTLCOLORBTN:
         SetBkMode(HDC)wParam, TRANSPARENT);
         return ((LRESULT)hbStatichBk); // Hintergrund färben

     case WM_DESTROY:
         // ...
         DeleteObject(hbStatichBk);
         PostQuitMessage(0);
         return (0L);
   }
}
</code></pre>
<p>einfach hbStatichBk ändern, und ein InvalidateRect(hWndStatic), NULL, FALSE); aufrufen, damit wird dein static dann neugezeichnet...denk an DeleteObject</p>
<p>PS: Selber denken schadet auch nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1104987</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1104987</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Wed, 26 Jul 2006 22:43:10 GMT</pubDate></item></channel></rss>