<?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[Bitmap Hintergrundfarbe im Static Control?]]></title><description><![CDATA[<p>Hi Community,<br />
ich verwende ein in einem Dialog ein Image Static Control (also ein Static Control mit Style &quot;SS_BITMAP&quot;).<br />
Geladen wird ein Monochrom-Bitmap (schwarz/weiß, 236x47 Pixel)</p>
<p>Auszug aus MyApp.rc:</p>
<pre><code class="language-cpp">// Dialog
//
CONTROL  115,IDC_BITMAP_PINBELEGUNG,&quot;Static&quot;,SS_BITMAP | SS_NOTIFY | SS_CENTERIMAGE,252,176,157,29

...

// Bitmap
//
IDB_SUBD25POLIG   BITMAP DISCARDABLE &quot;res\\SUB-D 25polig.bmp&quot;
</code></pre>
<p>IDB_SUBD25POLIG ist 115, definiert in resource.h</p>
<p>Wie kann ich die Hintergrundfarbe dieses Static Controls beeinflussen?<br />
(Eine harmlose Frage, aber sehr nervig, da ich nicht vorwärts komme!)</p>
<p>Auszug aus meiner Dialog-Prozedur:</p>
<pre><code class="language-cpp">case WM_CTLCOLORSTATIC:
//hdcStatic = (HDC)wParam;   //Handle to display context.
//hwndStatic = (HWND)lParam; //Handle to static control.
switch ( GetWindowLong( (HWND)lParam, GWL_ID ) )        //Resourcen-ID ermitteln.
{
  case IDC_BITMAP_PINBELEGUNG:
  SetTextColor( (HDC)wParam, RGB( 0x00, 0x80, 0x00 ) ); //grün.
  SetBkMode( (HDC)wParam, OPAQUE );
  SetBkColor( (HDC)wParam, RGB( 0xFF, 0xFF, 0x00 ) );   //gelb.
  return( (LRESULT)GetSysColorBrush( COLOR_BTNFACE ) ); //The return value is a handle to a brush that the system
                                                        //uses to paint the background of the static control.
}
</code></pre>
<p>(Ich habe hier bewußt die knalligen Farben gewählt, um die Effekte deutlich demonstrieren zu können)</p>
<p>Was hier die ganze Sache noch komplizierter macht: Es kommen völlig unterschiedliche Ergebnisse unter WinXP und Win2000 zu Tage!<br />
Unter Win XP:<br />
Farbe (&quot;Schrift&quot;) Bitmap = grün<br />
Hintergrund Bitmap = <strong>Dialog-Hintergrundfarbe</strong> // &lt;-- <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /> sollte gelb sein! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /><br />
Hintergrund um Bitmap herum = Dialog-Hintergrundfarbe</p>
<p>Unter Win 2000 (und älter) beobachte ich dagegen folgendes:<br />
Farbe (&quot;Schrift&quot;) Bitmap = grün<br />
Hintergrund Bitmap = gelb<br />
Hintergrund um Bitmap herum = <strong>weiß</strong> // &lt;-- <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /> sollte Dialog-Hintergrundfarbe sein! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /></p>
<p>Nun, meine zusammengefaßte Erkenntnisse:<br />
- Windows XP ignoriert offensichtlich meine gewünschte Hintergrundfarbe (hier: gelb gewünscht).<br />
- Windows 2000 ist offensichtlich nicht imstande, den Leerraum um den Bitmap herum mit irgendwas sinnvollem zu füllen (hier: Dialog-Hintergrundfarbe gewünscht).</p>
<p>Was mache ich da falsch? Ich hoffe, Ihr könnt mir weiterhelfen?<br />
Martin</p>
<p>P.S.: Ich verwende Visual Studio 6.0 mit SP6.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/197062/bitmap-hintergrundfarbe-im-static-control</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 22:33:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/197062.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 Nov 2007 10:19:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bitmap Hintergrundfarbe im Static Control? on Tue, 06 Nov 2007 10:19:25 GMT]]></title><description><![CDATA[<p>Hi Community,<br />
ich verwende ein in einem Dialog ein Image Static Control (also ein Static Control mit Style &quot;SS_BITMAP&quot;).<br />
Geladen wird ein Monochrom-Bitmap (schwarz/weiß, 236x47 Pixel)</p>
<p>Auszug aus MyApp.rc:</p>
<pre><code class="language-cpp">// Dialog
//
CONTROL  115,IDC_BITMAP_PINBELEGUNG,&quot;Static&quot;,SS_BITMAP | SS_NOTIFY | SS_CENTERIMAGE,252,176,157,29

...

// Bitmap
//
IDB_SUBD25POLIG   BITMAP DISCARDABLE &quot;res\\SUB-D 25polig.bmp&quot;
</code></pre>
<p>IDB_SUBD25POLIG ist 115, definiert in resource.h</p>
<p>Wie kann ich die Hintergrundfarbe dieses Static Controls beeinflussen?<br />
(Eine harmlose Frage, aber sehr nervig, da ich nicht vorwärts komme!)</p>
<p>Auszug aus meiner Dialog-Prozedur:</p>
<pre><code class="language-cpp">case WM_CTLCOLORSTATIC:
//hdcStatic = (HDC)wParam;   //Handle to display context.
//hwndStatic = (HWND)lParam; //Handle to static control.
switch ( GetWindowLong( (HWND)lParam, GWL_ID ) )        //Resourcen-ID ermitteln.
{
  case IDC_BITMAP_PINBELEGUNG:
  SetTextColor( (HDC)wParam, RGB( 0x00, 0x80, 0x00 ) ); //grün.
  SetBkMode( (HDC)wParam, OPAQUE );
  SetBkColor( (HDC)wParam, RGB( 0xFF, 0xFF, 0x00 ) );   //gelb.
  return( (LRESULT)GetSysColorBrush( COLOR_BTNFACE ) ); //The return value is a handle to a brush that the system
                                                        //uses to paint the background of the static control.
}
</code></pre>
<p>(Ich habe hier bewußt die knalligen Farben gewählt, um die Effekte deutlich demonstrieren zu können)</p>
<p>Was hier die ganze Sache noch komplizierter macht: Es kommen völlig unterschiedliche Ergebnisse unter WinXP und Win2000 zu Tage!<br />
Unter Win XP:<br />
Farbe (&quot;Schrift&quot;) Bitmap = grün<br />
Hintergrund Bitmap = <strong>Dialog-Hintergrundfarbe</strong> // &lt;-- <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /> sollte gelb sein! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /><br />
Hintergrund um Bitmap herum = Dialog-Hintergrundfarbe</p>
<p>Unter Win 2000 (und älter) beobachte ich dagegen folgendes:<br />
Farbe (&quot;Schrift&quot;) Bitmap = grün<br />
Hintergrund Bitmap = gelb<br />
Hintergrund um Bitmap herum = <strong>weiß</strong> // &lt;-- <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /> sollte Dialog-Hintergrundfarbe sein! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /></p>
<p>Nun, meine zusammengefaßte Erkenntnisse:<br />
- Windows XP ignoriert offensichtlich meine gewünschte Hintergrundfarbe (hier: gelb gewünscht).<br />
- Windows 2000 ist offensichtlich nicht imstande, den Leerraum um den Bitmap herum mit irgendwas sinnvollem zu füllen (hier: Dialog-Hintergrundfarbe gewünscht).</p>
<p>Was mache ich da falsch? Ich hoffe, Ihr könnt mir weiterhelfen?<br />
Martin</p>
<p>P.S.: Ich verwende Visual Studio 6.0 mit SP6.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1398516</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1398516</guid><dc:creator><![CDATA[Mmacher]]></dc:creator><pubDate>Tue, 06 Nov 2007 10:19:25 GMT</pubDate></item><item><title><![CDATA[Reply to Bitmap Hintergrundfarbe im Static Control? on Thu, 08 Nov 2007 15:42:47 GMT]]></title><description><![CDATA[<p>Bitte um einen Tipp, worin diese &quot;falschen&quot; Farben ihre Ursache haben könnten?</p>
<p>Habt Ihr auch das gleiche Problem?</p>
<p>Bleibt es mir möglicherweise nichts anderes übrig, als den Bitmap per Ownerdraw (mittels <em>WM_DRAWITEM</em>) in das Static Control zu zeichnen?<br />
Dann wäre ja der Sinn von Bitmap Static Control (mit <em>SS_BITMAP</em>) hinüber, wenn man es nicht vernünftig einsetzen kann.</p>
<p>Martin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1399848</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1399848</guid><dc:creator><![CDATA[Mmacher]]></dc:creator><pubDate>Thu, 08 Nov 2007 15:42:47 GMT</pubDate></item><item><title><![CDATA[Reply to Bitmap Hintergrundfarbe im Static Control? on Thu, 08 Nov 2007 16:19:23 GMT]]></title><description><![CDATA[<p>hast du es mal mit SetBkMode( (HDC)wParam, TRANSPARENT); probiert?</p>
<p>Nur so eine Idee...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1399873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1399873</guid><dc:creator><![CDATA[Der_Knob]]></dc:creator><pubDate>Thu, 08 Nov 2007 16:19:23 GMT</pubDate></item><item><title><![CDATA[Reply to Bitmap Hintergrundfarbe im Static Control? on Fri, 09 Nov 2007 10:19:34 GMT]]></title><description><![CDATA[<p>Hi Der_Knob,<br />
ja, das habe ich auch schon ausprobiert.<br />
Es zeigt sich kein Unterschied, ob ich</p>
<pre><code class="language-cpp">SetBkMode( (HDC)wParam, TRANSPARENT );
</code></pre>
<p>oder</p>
<pre><code class="language-cpp">SetBkMode( (HDC)wParam, OPAQUE );
</code></pre>
<p>verwende. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
<p>In der Zwischenzeit habe ich etwas &quot;Kleingedrucktes&quot; in der MSDN <a href="http://msdn2.microsoft.com/en-us/library/bb760773.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/bb760773.aspx</a> gelesen:</p>
<blockquote>
<p>SS_CENTERIMAGE<br />
Specifies that a bitmap is centered in the static control that contains it. The control is not resized, so that a bitmap too large for the control will be clipped. If the static control contains a single line of text, the text is centered vertically in the client area of the control.<br />
Microsoft Windows XP: <strong>This style bit no longer results in unused portions of the control being filled with the color of the top left pixel of the bitmap or icon. Unused portions of the control will remain the background color.</strong></p>
</blockquote>
<p>Besteht da ein Zusammenhang mit meiner Beobachtung? Bei genauem Hinlesen bezieht sich &quot;<em>unused portions</em>&quot; eigentlich auf den Bereich um den Bitmap herum, oder nicht? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Martin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1400177</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1400177</guid><dc:creator><![CDATA[Mmacher]]></dc:creator><pubDate>Fri, 09 Nov 2007 10:19:34 GMT</pubDate></item></channel></rss>