<?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[Hintergrundfarbe während der Runtime ändern]]></title><description><![CDATA[<p>Hallo</p>
<p>ich hab mich grad mal so schlau gemacht, was es so für Möglichkeiten gibt, die Hintergrundfarbe des Dialogs zu ändern.</p>
<p>Das funktioniert ja auch alles wunderbar, nur bis jetzt bin ich leider noch nicht fündig geworden, wie ich die während der Runtime ändern kann!?!</p>
<p>Ich kenne einmal die Möglichkeit mit der Instanz (SetDialogBkColor) dann mit dem Ereignishandler OnCtlColor und das überschreiben der On_EraseBk bla</p>
<p>Hab probiert, mit der On_EraseBk.... Methode mein rectanlge, wie ich es am anfang auch erzeigen lasse, einfach per Buttonklick wieder zu &quot;übermalen&quot;.</p>
<p>Das dumme ist nur, dass er diesmal, anstatt den Dialog, das Bitmap ausfüllt, was bei mir noch aufm Dialog liegt.</p>
<p>Von der Möglichkeit, ein Bitmap mit 1 Pixel Farbinfo zu strechtchen hab ich auch schon gelesen, mag es aber lieber erst anders versuchen.</p>
<p>Danke für eure Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/153758/hintergrundfarbe-während-der-runtime-ändern</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Jul 2026 12:07:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/153758.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Jul 2006 10:28:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 10:28:59 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>ich hab mich grad mal so schlau gemacht, was es so für Möglichkeiten gibt, die Hintergrundfarbe des Dialogs zu ändern.</p>
<p>Das funktioniert ja auch alles wunderbar, nur bis jetzt bin ich leider noch nicht fündig geworden, wie ich die während der Runtime ändern kann!?!</p>
<p>Ich kenne einmal die Möglichkeit mit der Instanz (SetDialogBkColor) dann mit dem Ereignishandler OnCtlColor und das überschreiben der On_EraseBk bla</p>
<p>Hab probiert, mit der On_EraseBk.... Methode mein rectanlge, wie ich es am anfang auch erzeigen lasse, einfach per Buttonklick wieder zu &quot;übermalen&quot;.</p>
<p>Das dumme ist nur, dass er diesmal, anstatt den Dialog, das Bitmap ausfüllt, was bei mir noch aufm Dialog liegt.</p>
<p>Von der Möglichkeit, ein Bitmap mit 1 Pixel Farbinfo zu strechtchen hab ich auch schon gelesen, mag es aber lieber erst anders versuchen.</p>
<p>Danke für eure Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1100967</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1100967</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 10:28:59 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 10:37:34 GMT]]></title><description><![CDATA[<p>Wo genau hast du denn die EraseBackground überschrieben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1100981</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1100981</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Thu, 20 Jul 2006 10:37:34 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 10:48:39 GMT]]></title><description><![CDATA[<p>einfach in einer Methode wenn ein Button geklickt wird</p>
<p>hier die Methode</p>
<pre><code class="language-cpp">BOOL AFK_Hand::OnEraseBkgnd(CDC* pDC)
{
	// TODO: Fügen Sie hier Ihren Meldungsbehandlungscode ein, und/oder benutzen Sie den Standard.
	CRect rect; 
	GetClientRect(&amp;rect); 
	pDC-&gt;FillSolidRect(&amp;rect, RGB(rot,gruen,blau)); 

	return CDialog::OnEraseBkgnd(pDC);
}
</code></pre>
<p>hier der erneute Aufruf</p>
<pre><code class="language-cpp">OnEraseBkgnd(pDC);
</code></pre>
<p>rot gruen und blau sind members, die ich vorm funktionsaufruf dementsprechende werte zuweise</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1100997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1100997</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 10:48:39 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 10:56:11 GMT]]></title><description><![CDATA[<p>ruf mal nicht die Methode der Elternklasse auf, damit machst doch dein Zeug wieder weg, weil die Standardimplementierung wieder aktiv ist dadurch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101021</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Thu, 20 Jul 2006 10:56:11 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 11:03:39 GMT]]></title><description><![CDATA[<p>ja ok</p>
<p>aber was hab ich denn noch für andere möglichkeiten außer das BMP?</p>
<p>bei der InitInstance kann ich des eh vergessen, EraseBkgnd geht auch so nicht, CtlColor kann ich nur nen brush zurück geben...</p>
<p>also das ma echt ne klasse aufgabe *ggg*</p>
<p>ich meine, ich kann auch mit kanonen auf spatzen schießen</p>
<p>wenn ich die hintergrundfarbe während der runtime ändern will, kann ich das aktuelle dialogfenster schließen, ein neues öffnen und dann in der InitInstance andere werte reinpacken</p>
<p>aber das ma doch echt net sinn der sache, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101031</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101031</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 11:03:39 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 11:19:11 GMT]]></title><description><![CDATA[<p>du? kein wunder dass er das BMP was ich da noch drinhabe auf diesen Bgrnd setzt</p>
<p>weil ich übergebe ihm dieses DC und nicht das Dialog DC</p>
<p>ich implementiere das mal eben um</p>
<p>ker, bei der hitze is das auch kein wunder...</p>
<p>kann man ja gar net mehr nachdenken</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101049</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101049</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 11:19:11 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 11:31:22 GMT]]></title><description><![CDATA[<p>*lol* ok</p>
<p>aber das Aufrufen der ELternmethode lass trotzdem mal draußen^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101065</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101065</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Thu, 20 Jul 2006 11:31:22 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 11:38:27 GMT]]></title><description><![CDATA[<p>damit mach ich das aber gerade wieder *Ggg*</p>
<p>also eigentlich ist das schonmal ein fortschritt, problem ist nur, dass er irgendwie nicht das ganze dialogfenster nimmt *ggg*</p>
<p>lustig ist auch, wenn ich das fenster verschiebe, ist das ding wieder weg <em>Ügg</em></p>
<p>ker, is das ma echt dumm <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101076</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101076</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 11:38:27 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 11:42:08 GMT]]></title><description><![CDATA[<p>Ich test das auch ma grad, bei mir wird der Hintergrund immer nur schwarz??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101087</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101087</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Thu, 20 Jul 2006 11:42:08 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 11:44:09 GMT]]></title><description><![CDATA[<p>jo, bei mir kommen auch so lustig sachen raus *gg*</p>
<p>bei FloodFill z.B. is bei mir alles weiß <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101090</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 11:44:09 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 11:45:17 GMT]]></title><description><![CDATA[<p>hast du ICQ, bevor wir das ganze Forum vollspammen mit der Farbe?<br />
meine Nummer: 191133458</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101093</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101093</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Thu, 20 Jul 2006 11:45:17 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 11:54:21 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">//
BOOL CDialogTestDlg::OnEraseBkgnd(CDC* pDC)
{
	CRect rect;
    GetClientRect(&amp;rect);	

	pDC-&gt;FillSolidRect(&amp;rect,RGB(1,0,255));

	return true;
}
</code></pre>
<p>Ok also damit macht er es bei mir. Mein Fehler war die OpenGL-Denke, da gehen die Farbangaben von 0-1 und nicht bis 255^^ Daher war alles schwarz.</p>
<p>Was natürlich nicht blau wird, ist der Hintergrund der Steuerelemente, die bleiben Standardgrau, dazu musst dann wohl die WM_CTLCOLOR abfangen.</p>
<p>Aber alles was zum Dialoghintergrund gehört wird eingefärbt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101118</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101118</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Thu, 20 Jul 2006 11:54:21 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 12:03:24 GMT]]></title><description><![CDATA[<p>hmm, irgendwie funzt das hier net</p>
<p>haben nen proxy druf</p>
<p>schon alles probiert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101130</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 12:03:24 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 12:14:00 GMT]]></title><description><![CDATA[<p>ja genau</p>
<p>so hab ich das ja auch</p>
<p>und wenn de jetzt nen button nimmst und da mal das ausführen lässt</p>
<pre><code class="language-cpp">CDC* WindowCDC;
WindowCDC = GetWindowDC();
OnEraseBgrnd(WindowCDC);
</code></pre>
<p>da passiert da was ganz komisches</p>
<p>brauchste noch netmal die farbwerte verändern</p>
<p>einfach mal aufrufen das ding per button oder sp</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101159</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101159</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 12:14:00 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 12:20:54 GMT]]></title><description><![CDATA[<p>alles klar</p>
<p>ich habs</p>
<p>ich räum nur mal eben die CPP datei auf und dann poste ich den code</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101174</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101174</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 12:20:54 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 12:35:23 GMT]]></title><description><![CDATA[<p>MSS-Software schrieb:</p>
<blockquote>
<p>ja genau</p>
<p>so hab ich das ja auch</p>
<p>und wenn de jetzt nen button nimmst und da mal das ausführen lässt</p>
<pre><code class="language-cpp">CDC* WindowCDC;
WindowCDC = GetWindowDC();
OnEraseBgrnd(WindowCDC);
</code></pre>
<p>da passiert da was ganz komisches</p>
<p>brauchste noch netmal die farbwerte verändern</p>
<p>einfach mal aufrufen das ding per button oder sp</p>
</blockquote>
<p>Ich würde da aber eher für das Elternfenster des Buttons Invalidate() aufrufen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101195</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101195</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Thu, 20 Jul 2006 12:35:23 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 12:48:43 GMT]]></title><description><![CDATA[<p>ja, hab ich ja jetzt auch so gemacht</p>
<p>also hier der code:</p>
<p>1. 2 Member anlegen</p>
<p>*.h</p>
<pre><code class="language-cpp">COLORREF m_crColors;
BOOL m_bMerker;
</code></pre>
<ol start="2">
<li></li>
</ol>
<pre><code class="language-cpp">this-&gt;m_crColors = RGB(255,0,0); //Entweder im Constructor oder OnInitDialog
this-&gt;m_bMerker = FALSE;         //Entweder im Constructor oder OnInitDialog

void CTest::OnPaint()
{
   CPaintDC dc(this); // device context for painting
   if ( this-&gt;m_bMerker )
      this-&gt;ReDrawBgColor();
}

BOOL CTest::OnEraseBkgnd(CDC* pDC)
{
   // TODO: Fügen Sie hier Ihren Meldungsbehandlungscode ein, und/oder benutzen Sie den Standard.

   CRect rect;
   GetClientRect(&amp;rect); 
   pDC-&gt;FillSolidRect(&amp;rect,this-&gt;m_crColors); 

   return CDialog::OnEraseBkgnd(pDC);
}

void CTest::ReDrawBgColor()
{
   CDC *WindowCDC;
   WindowCDC = this-&gt;GetDC();
   this-&gt;OnEraseBkgnd(WindowCDC);
}

/////--------- Jetzt die Farbänderung per Buttonclick etc ------------- ////////

void CTest::OnBnClickedButtonChangeColor()
{
   this-&gt;m_crColors = RGB(0,255,0);
   this-&gt;m_bMerker = TRUE;
   this-&gt;ReDrawBgColor();
   this-&gt;Invalidate();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1101211</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101211</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 12:48:43 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 12:51:31 GMT]]></title><description><![CDATA[<p>da muss ich intervenieren^^</p>
<p>this-&gt;ReDrawBgColor();<br />
lass das mal lieber raus</p>
<p>Erstens holst du da drinnen mit GetDC() nen COntext und gibst ihn nicht wieder frei mit ReleaseDC -&gt; MemLeak</p>
<p>Zweitens: Invalidate() in dieser Form löst automatisch ein Erase-Background aus :), ist also unnötig das selber vorher noch zu tun</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101216</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101216</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Thu, 20 Jul 2006 12:51:31 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundfarbe während der Runtime ändern on Thu, 20 Jul 2006 13:06:35 GMT]]></title><description><![CDATA[<p>zu 1</p>
<p>jo, sorry; hab ich gar net druf geachtet gehabt *schäm*</p>
<p>zu 2</p>
<p>hintergrund sollte sein, dass ich das net immer neu alles eintippen muss und in der OnErase... kannste das ja net erst machen, weil er ja einen übergabe DC braucht</p>
<p>das einzigste wäre dafür eine member zu machen</p>
<p>hab noch die idee gehabt, dass als zusätzliche methode in die CDC Klasse mit einzubinden</p>
<p>aber das wird schwierig denke ich, denn du musst ja auch in die OnPaint schreiben....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1101227</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101227</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Thu, 20 Jul 2006 13:06:35 GMT</pubDate></item></channel></rss>