<?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[Hintergrundbild]]></title><description><![CDATA[<p>Ich möchte in einem Dialog ein Hintergurndbild einbetten. Da ich es stretchen muss, erledige ich das ganze in &quot;::OnPaint()&quot;. Zusätlich habe ich ein paar statische Texte, die ich im Dialog &quot;gemalt&quot; habe. Leider erscheinen die nicht transparent, d.h. ich sehe beim Start des Programms graue Rechtecke im Bild. Welche Methode muss ich denn jetzt aufrufen, um die grauen Felder wegzukriegen?</p>
<pre><code class="language-cpp">void CPlanetenatmosphäreDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // Gerätekontext für Zeichnen

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Symbol in Client-Rechteck zentrieren
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&amp;rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Symbol zeichnen
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{

		CClientDC dc(this);
		BITMAP bm;
		Hintergrundbild.GetObject(sizeof(bm),&amp;bm);
		CDC SpeicherDC;
		SpeicherDC.CreateCompatibleDC(&amp;dc);
		SpeicherDC.SelectObject(&amp;Hintergrundbild);
		CRect Rect;
		GetClientRect(&amp;Rect);
		dc.SetStretchBltMode(HALFTONE);
		dc.StretchBlt(0,0,Rect.right, Rect.bottom,&amp;SpeicherDC, 0,0,bm.bmWidth, bm.bmHeight, SRCCOPY);

		CDialog::OnPaint();
	}

}
</code></pre>
<p>Gruss Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/82875/hintergrundbild</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 05:08:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/82875.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Aug 2004 12:13:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hintergrundbild on Sun, 15 Aug 2004 12:13:10 GMT]]></title><description><![CDATA[<p>Ich möchte in einem Dialog ein Hintergurndbild einbetten. Da ich es stretchen muss, erledige ich das ganze in &quot;::OnPaint()&quot;. Zusätlich habe ich ein paar statische Texte, die ich im Dialog &quot;gemalt&quot; habe. Leider erscheinen die nicht transparent, d.h. ich sehe beim Start des Programms graue Rechtecke im Bild. Welche Methode muss ich denn jetzt aufrufen, um die grauen Felder wegzukriegen?</p>
<pre><code class="language-cpp">void CPlanetenatmosphäreDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // Gerätekontext für Zeichnen

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Symbol in Client-Rechteck zentrieren
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&amp;rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Symbol zeichnen
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{

		CClientDC dc(this);
		BITMAP bm;
		Hintergrundbild.GetObject(sizeof(bm),&amp;bm);
		CDC SpeicherDC;
		SpeicherDC.CreateCompatibleDC(&amp;dc);
		SpeicherDC.SelectObject(&amp;Hintergrundbild);
		CRect Rect;
		GetClientRect(&amp;Rect);
		dc.SetStretchBltMode(HALFTONE);
		dc.StretchBlt(0,0,Rect.right, Rect.bottom,&amp;SpeicherDC, 0,0,bm.bmWidth, bm.bmHeight, SRCCOPY);

		CDialog::OnPaint();
	}

}
</code></pre>
<p>Gruss Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/583153</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/583153</guid><dc:creator><![CDATA[black_sheep_thomas]]></dc:creator><pubDate>Sun, 15 Aug 2004 12:13:10 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundbild on Sun, 15 Aug 2004 21:48:06 GMT]]></title><description><![CDATA[<p>vielleicht klappts ja hiermit...</p>
<pre><code>dc.SetBkMode(TRANSPARENT);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/583386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/583386</guid><dc:creator><![CDATA[dude77]]></dc:creator><pubDate>Sun, 15 Aug 2004 21:48:06 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundbild on Mon, 16 Aug 2004 08:17:49 GMT]]></title><description><![CDATA[<p>wer weiss wie man die suchfunktion benutzt hat einen vorteil</p>
<p><a href="http://www.c-plusplus.net/forum/viewtopic.php?t=80930&amp;highlight=hintergrund" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic.php?t=80930&amp;highlight=hintergrund</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/583512</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/583512</guid><dc:creator><![CDATA[Emperor_L0ser]]></dc:creator><pubDate>Mon, 16 Aug 2004 08:17:49 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundbild on Mon, 16 Aug 2004 18:15:56 GMT]]></title><description><![CDATA[<p>dude77 -&gt; Sorry, aber das habe ich auch bereits auprobiert. Funzt nicht.</p>
<p>Emperor_L0ser -&gt; Den Beitrag habe ich nicht gefunden... (Suchen muss man könnnen *g*)</p>
<p>Vielen Dank<br />
Gruss Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/584016</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/584016</guid><dc:creator><![CDATA[black_sheep_thomas]]></dc:creator><pubDate>Mon, 16 Aug 2004 18:15:56 GMT</pubDate></item><item><title><![CDATA[Reply to Hintergrundbild on Tue, 17 Aug 2004 02:57:45 GMT]]></title><description><![CDATA[<p>Noch zum Thema Transparenz in Bitmaps:<br />
<a href="http://www.henkessoft.de/mfc_einsteigerbuch_kapitel4.htm" rel="nofollow">http://www.henkessoft.de/mfc_einsteigerbuch_kapitel4.htm</a><br />
siehe dort Kap. 4.2 Transparente Bitmaps erzeugen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/584273</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/584273</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Tue, 17 Aug 2004 02:57:45 GMT</pubDate></item></channel></rss>