<?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[Hintergurnd eines Fensters setzen]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte das mein Fenster mit einer Frabegefüllt wird. Da hab ich mir gedacht ich könnt einfach mit &quot;SetBkColor&quot; die Hintergrundfarbe ändern und neu Zeichnen und schon hat es die Farbe. Aber iwie klappt das nicht.<br />
Hier mal ein auszug auf meinem Code:</p>
<pre><code class="language-cpp">......
	WNDCLASS wnd;

	wnd.style = CS_VREDRAW | CS_HREDRAW;
	wnd.cbClsExtra = 0;
	wnd.cbWndExtra = 4;
	wnd.hInstance = hInstance;
	wnd.hIcon = NULL;
	wnd.hCursor = LoadCursor(NULL, IDC_ARROW);
	wnd.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
	wnd.lpszMenuName = NULL;
	wnd.lpszClassName = CLASS_NAME;
	wnd.lpfnWndProc = PixelWndProc;
.....

		case WM_LBUTTONDOWN:
		{
			int iCur = GetWindowLong(hWnd,0);

			if(iCur == 0)
			{

				hdc = GetDC(hWnd);
				SetBkColor(hdc, RGB(0,0,0));
				ReleaseDC(hWnd, hdc);

				SetWindowLong(hWnd,0, !iCur);
				InvalidateRect(hWnd, NULL, TRUE);
			}

			return 0;
</code></pre>
<p>Sollte ja jetzt imho schwarz werden oder !?</p>
<p>Danke schon mal für die Hilfe</p>
<p>Gruß Pingu</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/233459/hintergurnd-eines-fensters-setzen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 23:54:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/233459.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 04 Feb 2009 21:48:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hintergurnd eines Fensters setzen on Wed, 04 Feb 2009 21:48:35 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte das mein Fenster mit einer Frabegefüllt wird. Da hab ich mir gedacht ich könnt einfach mit &quot;SetBkColor&quot; die Hintergrundfarbe ändern und neu Zeichnen und schon hat es die Farbe. Aber iwie klappt das nicht.<br />
Hier mal ein auszug auf meinem Code:</p>
<pre><code class="language-cpp">......
	WNDCLASS wnd;

	wnd.style = CS_VREDRAW | CS_HREDRAW;
	wnd.cbClsExtra = 0;
	wnd.cbWndExtra = 4;
	wnd.hInstance = hInstance;
	wnd.hIcon = NULL;
	wnd.hCursor = LoadCursor(NULL, IDC_ARROW);
	wnd.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
	wnd.lpszMenuName = NULL;
	wnd.lpszClassName = CLASS_NAME;
	wnd.lpfnWndProc = PixelWndProc;
.....

		case WM_LBUTTONDOWN:
		{
			int iCur = GetWindowLong(hWnd,0);

			if(iCur == 0)
			{

				hdc = GetDC(hWnd);
				SetBkColor(hdc, RGB(0,0,0));
				ReleaseDC(hWnd, hdc);

				SetWindowLong(hWnd,0, !iCur);
				InvalidateRect(hWnd, NULL, TRUE);
			}

			return 0;
</code></pre>
<p>Sollte ja jetzt imho schwarz werden oder !?</p>
<p>Danke schon mal für die Hilfe</p>
<p>Gruß Pingu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1658187</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1658187</guid><dc:creator><![CDATA[Pingu-Group]]></dc:creator><pubDate>Wed, 04 Feb 2009 21:48:35 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergurnd eines Fensters setzen on Thu, 05 Feb 2009 06:50:57 GMT]]></title><description><![CDATA[<p>Ein DC ist ein temporäres Objekt und hält keinen Status!</p>
<p>Wenn Du also den Hintergrund änern willst musst Du den entsprechenden Messagehandler einbauen: WM_ERASEBKGND. Ei Neuzeichnen muss dann erzwungen werden mit InvalidateRect...</p>
<p>Lies mal ein Tutorial, damit Du verstehst, wie bei Windows die Informatzionen dargestellt und gezeichnet werden (siehe WM_PAINT).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1658252</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1658252</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Thu, 05 Feb 2009 06:50:57 GMT</pubDate></item></channel></rss>