<?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[WM_CTLCOLORSTATIC und HOLLOW_BRUSH für eine Trackbar]]></title><description><![CDATA[<p>Hallo,<br />
also irgendwie bekomme ich folgendes nicht vernünftig hin:</p>
<pre><code>LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HDC hdcStatic = (HDC)wParam;
case WM_CREATE:
{
...
hwndSlider = CreateWindow(TRACKBAR_CLASS,&quot;&quot;,WS_CHILD | WS_VISIBLE | TBS_NOTICKS ,1,1,120,20, hwnd,(HMENU)0,(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),NULL);
...
}

case WM_CTLCOLORSTATIC:
{
SetBkMode(hdcStatic, TRANSPARENT);
return (LONG)GetStockObject(HOLLOW_BRUSH);
}

}
</code></pre>
<p>leider führt das zu sowas:<br />
<a href="http://img316.imageshack.us/my.php?image=bild18km.jpg" rel="nofollow">http://img316.imageshack.us/my.php?image=bild18km.jpg</a></p>
<p>Wenn ich irgendeinen Brush mit Farbe wähle, also z.B. GRAY_BRUSH funktioniert es.</p>
<p>mfg<br />
Peter</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/116225/wm_ctlcolorstatic-und-hollow_brush-für-eine-trackbar</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 10:26:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/116225.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 24 Jul 2005 18:32:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to WM_CTLCOLORSTATIC und HOLLOW_BRUSH für eine Trackbar on Sun, 24 Jul 2005 18:32:52 GMT]]></title><description><![CDATA[<p>Hallo,<br />
also irgendwie bekomme ich folgendes nicht vernünftig hin:</p>
<pre><code>LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HDC hdcStatic = (HDC)wParam;
case WM_CREATE:
{
...
hwndSlider = CreateWindow(TRACKBAR_CLASS,&quot;&quot;,WS_CHILD | WS_VISIBLE | TBS_NOTICKS ,1,1,120,20, hwnd,(HMENU)0,(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),NULL);
...
}

case WM_CTLCOLORSTATIC:
{
SetBkMode(hdcStatic, TRANSPARENT);
return (LONG)GetStockObject(HOLLOW_BRUSH);
}

}
</code></pre>
<p>leider führt das zu sowas:<br />
<a href="http://img316.imageshack.us/my.php?image=bild18km.jpg" rel="nofollow">http://img316.imageshack.us/my.php?image=bild18km.jpg</a></p>
<p>Wenn ich irgendeinen Brush mit Farbe wähle, also z.B. GRAY_BRUSH funktioniert es.</p>
<p>mfg<br />
Peter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/837626</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/837626</guid><dc:creator><![CDATA[Lastwebpage]]></dc:creator><pubDate>Sun, 24 Jul 2005 18:32:52 GMT</pubDate></item><item><title><![CDATA[Reply to WM_CTLCOLORSTATIC und HOLLOW_BRUSH für eine Trackbar on Sun, 24 Jul 2005 18:34:18 GMT]]></title><description><![CDATA[<p>das bild funktioniert nicht!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/837627</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/837627</guid><dc:creator><![CDATA[tipp]]></dc:creator><pubDate>Sun, 24 Jul 2005 18:34:18 GMT</pubDate></item><item><title><![CDATA[Reply to WM_CTLCOLORSTATIC und HOLLOW_BRUSH für eine Trackbar on Sun, 24 Jul 2005 19:43:34 GMT]]></title><description><![CDATA[<p>Also bei mir funktioniert dein Bild.<br />
So sieht ein Fenster nun mal aus, wenn man mit einem durchsichtigen Pinsel den Hintergrund übermalt. Was hast du denn erwartet, dass man das darunter liegende Fenster sieht? Im echten Leben kannst du eine Wand ja auch nicht so anstreichen, dass sie durchsichtig wird. Du kannst Sie allerdings so anmalen, dass sie so aussieht, also ob sie durchsichtig wäre.<br />
Im Programm musst du also WM_ERASEBKGND von der Trackbar verarbeiten (Subclassing) und dort den Hintergrund deines Fensters malen. (zumindest theoretisch sollte es so funktionieren)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/837710</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/837710</guid><dc:creator><![CDATA[D*niel *chumann]]></dc:creator><pubDate>Sun, 24 Jul 2005 19:43:34 GMT</pubDate></item><item><title><![CDATA[Reply to WM_CTLCOLORSTATIC und HOLLOW_BRUSH für eine Trackbar on Sun, 24 Jul 2005 19:45:29 GMT]]></title><description><![CDATA[<p>ach das bild war so klein ich dachte das gehört zur seite. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/837712</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/837712</guid><dc:creator><![CDATA[tipp]]></dc:creator><pubDate>Sun, 24 Jul 2005 19:45:29 GMT</pubDate></item><item><title><![CDATA[Reply to WM_CTLCOLORSTATIC und HOLLOW_BRUSH für eine Trackbar on Mon, 25 Jul 2005 12:26:29 GMT]]></title><description><![CDATA[<p>Irgendeinen kleinen weiterführenden Tip vielleicht?<br />
Ich habe jetzt verschiedene Möglichkeiten von WM_ERASEBKGND in der Subclass von TRACKBAR_CLASS getestet, aber irgendwie scheint sich das nicht auf den HINTERGRUND der Trackbar auszuwirken, wenn ich z.B. folgenden Code in der Subclasse verwende:</p>
<pre><code>static HBRUSH hBrush = NULL; 
static RECT   rect; 
switch(msg)
{
case WM_ERASEBKGND:
hBrush = CreateSolidBrush( RGB(255, 0 ,0) ); 
GetClientRect( hwnd, &amp;rect );           
FillRect( (HDC)wParam , &amp;rect , hBrush ); 
return TRUE;

case WM_PAINT:
XXXX
break;
}
return CallWindowProc(oldSliderWindowProc, hwnd, msg, wParam, lParam);
</code></pre>
<p>So wenn ich das WM_PAINT weglasse passiert genau dasselbe wie im Bild des ersten postings, wenn ich einen Zeichencode in WM_PAINT einfüge erhalte ich einen konstanten roten Balken, ohne &quot;Schieberegler&quot; <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
(Was mich aber auch nicht wundert)</p>
<p>Konstruktionen wie:<br />
case WM_ERASEBKGND:<br />
return True;<br />
führen auch nur zum ergebnis des ersten Postings.</p>
<p>Also irgendwie stehe ich im Moment ziemlich auf dem Schlauch, und für irgendeinen kleinen Tip wäre ich dankbar.</p>
<p>Peter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/838197</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/838197</guid><dc:creator><![CDATA[Lastwebpage]]></dc:creator><pubDate>Mon, 25 Jul 2005 12:26:29 GMT</pubDate></item><item><title><![CDATA[Reply to WM_CTLCOLORSTATIC und HOLLOW_BRUSH für eine Trackbar on Tue, 26 Jul 2005 23:04:17 GMT]]></title><description><![CDATA[<p>Ich hab es jetzt auch mal probiert, auch noch andere Varianten mit WM_PAINT, usw. aber bei mir hats auch nicht geklappt, sorry. Die Trackbar zeichnet den Hintergrund leider selbst in WM_PAINT (wahrscheinlich nutz Sie einen Backbuffer und löscht dessen Hintergrund mit dem aktuellen Pinsel).</p>
<p>Evtl. ginge es noch mit Custom Draw. Die Trackbar besteht laut MSDN aus drei Elementen: TBCD_CHANNEL, TBCD_THUMB, TBCD_TICS. Vlt. kann man bei TBCD_CHANNEL den Hintergrund selbt zeichnen. Die Custom Draw - Funktionen der CommomControls mag ich allerdings nicht und werde es deshalb jetzt auch nicht testen. Ich wünsch dir aber noch viel Erfolg damit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/839539</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/839539</guid><dc:creator><![CDATA[D*niel *chumann]]></dc:creator><pubDate>Tue, 26 Jul 2005 23:04:17 GMT</pubDate></item><item><title><![CDATA[Reply to WM_CTLCOLORSTATIC und HOLLOW_BRUSH für eine Trackbar on Wed, 22 Mar 2006 10:44:06 GMT]]></title><description><![CDATA[<p>Wer an einer Lösung interessiert ist:</p>
<p>a) Slider subclassen, im WM_PAINT folgenden Code:<br />
PAINTSTRUCT ps;</p>
<p>BeginPaint(_hWnd,&amp;ps);</p>
<p>clsWrapDC DC(wParam ? (HDC)wParam : ps.hdc);<br />
clsRect rc(ps.rcPaint);</p>
<p>__ThemeManager.DrawThemeParentBackground(_hWnd,DC,rc); // Hintergrund malen!<br />
SendMessage(_hWnd,WM_PRINT,HANDLE2INT((HDC)DC),PRF_CLIENT);</p>
<p>EndPaint(_hWnd,&amp;ps);<br />
return(0); // we did it!</p>
<p>b) bei dem Dialog WM_CTLCOLORSTATIC abfangen, und dann beim Slider-Control:</p>
<p>if (GET_ID(hWnd) == IDC_SLIDER)<br />
{<br />
clsWrapDC DC((HDC)wParam);</p>
<p>// oofffff..... nicht des feinen Mannes Art!!!<br />
__ThemeManager.DrawThemeParentBackground(hWnd,DC,clsRect(hWnd));<br />
SetBkMode(DC, TRANSPARENT);<br />
SelectObject(DC, GetStockBrush(HOLLOW_BRUSH));<br />
return(HANDLE2INT(GetStockBrush(HOLLOW_BRUSH)));<br />
}</p>
<p>Sorry für die Benutzung interner Klassen, aber das Prinzip dürfte klar sein. So kann man einen Slider (zumindest unter XP getestet) sogar auf beliebigen Hintergründen, also auch Bitmaps oder Farbverläufen, 'transparent' malen lassen.</p>
<p>Ch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1021575</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1021575</guid><dc:creator><![CDATA[Ch.Kaiser]]></dc:creator><pubDate>Wed, 22 Mar 2006 10:44:06 GMT</pubDate></item></channel></rss>