<?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[bei &amp;quot;edit&amp;quot; Control&amp;amp;#65292;wie kann man die Hintergrund-Farbe des controls ändern?]]></title><description><![CDATA[<p>hallo,<br />
bei folgendem Code kann ich nur die Hintergrund-Farbe des Texts ändern,</p>
<pre><code>case WM_CTLCOLOREDIT :
           SetTextColor((HDC)wParam, RGB(255,0,0));
          SetBkColor((HDC)wParam, RGB(0,255,0));
          return (LRESULT)hbrush;
</code></pre>
<p>die Frage:<br />
egal welche hbrush ich benutze, ändert sich die Hintergrund-Farbe nicht. wieso? danke vorher.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/224135/bei-quot-edit-quot-control-amp-65292-wie-kann-man-die-hintergrund-farbe-des-controls-ändern</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 20:19:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/224135.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Oct 2008 07:30:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to bei &amp;quot;edit&amp;quot; Control&amp;amp;#65292;wie kann man die Hintergrund-Farbe des controls ändern? on Mon, 06 Oct 2008 07:30:21 GMT]]></title><description><![CDATA[<p>hallo,<br />
bei folgendem Code kann ich nur die Hintergrund-Farbe des Texts ändern,</p>
<pre><code>case WM_CTLCOLOREDIT :
           SetTextColor((HDC)wParam, RGB(255,0,0));
          SetBkColor((HDC)wParam, RGB(0,255,0));
          return (LRESULT)hbrush;
</code></pre>
<p>die Frage:<br />
egal welche hbrush ich benutze, ändert sich die Hintergrund-Farbe nicht. wieso? danke vorher.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594015</guid><dc:creator><![CDATA[damo]]></dc:creator><pubDate>Mon, 06 Oct 2008 07:30:21 GMT</pubDate></item><item><title><![CDATA[Reply to bei &amp;quot;edit&amp;quot; Control&amp;amp;#65292;wie kann man die Hintergrund-Farbe des controls ändern? on Wed, 08 Oct 2008 05:39:46 GMT]]></title><description><![CDATA[<p>Hmm, ist vielleicht Transparenz eingeschaltet? Das könntest du mit SetBkMode ändern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1595229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1595229</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Wed, 08 Oct 2008 05:39:46 GMT</pubDate></item><item><title><![CDATA[Reply to bei &amp;quot;edit&amp;quot; Control&amp;amp;#65292;wie kann man die Hintergrund-Farbe des controls ändern? on Wed, 08 Oct 2008 09:21:07 GMT]]></title><description><![CDATA[<p>Hmmm,<br />
wie sind <em>hdc</em> und <em>hbrush</em> definiert bzw. welche Werte haben sie?</p>
<p>Der return-Wert soll mit <em>(HBRUSH)</em> und nicht mit <em>(LRESULT)</em> gecastet werden.</p>
<p>Versuche es mal so:</p>
<pre><code class="language-cpp">HDC hdc;

...

case WM_CTLCOLOREDIT:
  hdc = (HDC)wParam;  //handle to the device context for the edit control.
  SetTextColor( hdc, RGB( 255, 0, 0 ) );  //rot
  SetBkColor( hdc, RGB( 255, 255, 0 ) );  //gelb
  return( (HBRUSH)GetSysColorBrush( COLOR_3DHILIGHT ) ); //hilight color
</code></pre>
<p>HTH,<br />
Martin</p>
<p>[Nachtrag:]<br />
Wichtig ist natürlich auch, daß das Edit-Control weder &quot;read-only&quot; noch &quot;disabled&quot; ist! -&gt; Wenn doch: In diesem Fall erhältst Du <em>WM_CTLCOLORSTATIC</em> und nicht <em>WM_CTLCOLOREDIT</em>!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1595349</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1595349</guid><dc:creator><![CDATA[Mmacher]]></dc:creator><pubDate>Wed, 08 Oct 2008 09:21:07 GMT</pubDate></item><item><title><![CDATA[Reply to bei &amp;quot;edit&amp;quot; Control&amp;amp;#65292;wie kann man die Hintergrund-Farbe des controls ändern? on Wed, 08 Oct 2008 11:28:29 GMT]]></title><description><![CDATA[<p>vielen Dank für Hilfe! endlich ich hab's !!!<br />
hbrush soll &quot;static&quot; definiert werden!!! weil es in &quot;WM_CREATE :&quot; definiert wird!</p>
<pre><code>case WM_CREATE :
        hbrush_ctrl = (HBRUSH)GetStockObject(WHITE_BRUSH);
</code></pre>
<p>bei default ist BLACK_BRUSH.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/16702">@_matze</a>: bei default ist &quot;OPAQUE&quot;, oder?<br />
<a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/16457">@Mmacher</a>:<br />
hhehe, welche Compiler hast du? bei meinem VS2008:<br />
error C2440: 'return' : cannot convert from 'HBRUSH' to 'LRESULT'</p>
<p>trotzdem vielen Dank!<br />
vielleicht mir weiter helfen?<br />
meine Text in einem kleinen edit control kann nicht vertikal zentriert, wie schafft man das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1595463</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1595463</guid><dc:creator><![CDATA[damo]]></dc:creator><pubDate>Wed, 08 Oct 2008 11:28:29 GMT</pubDate></item></channel></rss>