<?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[Cstatic Ausgabe flackert]]></title><description><![CDATA[<p>Ich habe eine CStatic Klasse abgeleitet, so dass ich in das Fenster Daten Plotten kann. Genauergesagt plotte ich Matrizen, bzw. den Farbwert an (x,y). Das mache ich über zwei for-Schleifen. Dabei flackert allerdings der Bildschirm deutlich.</p>
<p>Ich würde daher viel lieber die Farbinformationen in ein Bild schreiben, dass dann im ganzen auf den Bildschirm gebracht wird.</p>
<p>Wie macht man das ?</p>
<p>Matthias</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/173041/cstatic-ausgabe-flackert</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 01:02:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/173041.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 11 Feb 2007 07:58:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Sun, 11 Feb 2007 07:58:36 GMT]]></title><description><![CDATA[<p>Ich habe eine CStatic Klasse abgeleitet, so dass ich in das Fenster Daten Plotten kann. Genauergesagt plotte ich Matrizen, bzw. den Farbwert an (x,y). Das mache ich über zwei for-Schleifen. Dabei flackert allerdings der Bildschirm deutlich.</p>
<p>Ich würde daher viel lieber die Farbinformationen in ein Bild schreiben, dass dann im ganzen auf den Bildschirm gebracht wird.</p>
<p>Wie macht man das ?</p>
<p>Matthias</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226644</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226644</guid><dc:creator><![CDATA[pospiech]]></dc:creator><pubDate>Sun, 11 Feb 2007 07:58:36 GMT</pubDate></item><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Sun, 11 Feb 2007 13:00:38 GMT]]></title><description><![CDATA[<p>Du brauchst einen MemDC, in den Renderst du die Daten und blittest dann das Ergebnis dann in dein Steuerelement.<br />
Mit CreateCompatibleDC kriegst du so einen DC. Irgendwo im FAQ ist da glaube auch ein Artikel dazu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226818</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226818</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Sun, 11 Feb 2007 13:00:38 GMT</pubDate></item><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Mon, 12 Feb 2007 16:53:41 GMT]]></title><description><![CDATA[<p>Ich habe es ausprobiert mit folgendem Code - der mir allerdings nur nichts anzeigt:</p>
<pre><code class="language-cpp">void CGraphCtrl::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	CRect rc;
	GetClientRect(rc);

	CDC* pDCMem;
	pDCMem = new CDC;
	pDCMem-&gt;CreateCompatibleDC(&amp;dc);

        [...]
        pDCMem-&gt;SetPixel(ix,iy,c); 
        [...]

	dc.BitBlt(0,0,rc.Width(),rc.Height(),pDCMem,0,0,SRCCOPY);
	delete pDCMem;

}
</code></pre>
<p>was ist daran jetzt falsch ?</p>
<p>Matthias</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1227571</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1227571</guid><dc:creator><![CDATA[pospiech]]></dc:creator><pubDate>Mon, 12 Feb 2007 16:53:41 GMT</pubDate></item><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Mon, 12 Feb 2007 17:07:31 GMT]]></title><description><![CDATA[<p>Verwende doch einfaqch CMemDC aus <a href="http://www.codeproject.com" rel="nofollow">www.codeproject.com</a> das ist IMHO einfacher und vor Allem funktioniert es.<br />
Vergiss bitte nicht einen WM_ERASEBKGND Handler einzubauen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1227590</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1227590</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 12 Feb 2007 17:07:31 GMT</pubDate></item><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Mon, 12 Feb 2007 17:18:02 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Verwende doch einfaqch CMemDC aus <a href="http://www.codeproject.com" rel="nofollow">www.codeproject.com</a> das ist IMHO einfacher und vor Allem funktioniert es.<br />
Vergiss bitte nicht einen WM_ERASEBKGND Handler einzubauen.</p>
</blockquote>
<p>Dazu habe ich diesen Artikel gefunden:<br />
<a href="http://www.codeproject.com/vcpp/gdiplus/what_is_a_basename_.asp" rel="nofollow">http://www.codeproject.com/vcpp/gdiplus/what_is_a_basename_.asp</a></p>
<p>Aber wie zeichne ich den dann, und mit welchem dc ? Genau der Punkt fehlt in dem Beispiel, zumindest sehe ich ihn nicht.</p>
<p>Matthias</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1227607</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1227607</guid><dc:creator><![CDATA[pospiech]]></dc:creator><pubDate>Mon, 12 Feb 2007 17:18:02 GMT</pubDate></item><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Mon, 12 Feb 2007 21:23:09 GMT]]></title><description><![CDATA[<p>schau mal in der MSDN nach CDC::CreateCompatibleDC da gibts ein Code-Beispiel, evtl hilft dir das <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/1227773</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1227773</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Mon, 12 Feb 2007 21:23:09 GMT</pubDate></item><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Tue, 13 Feb 2007 07:39:03 GMT]]></title><description><![CDATA[<p>pospiech schrieb:</p>
<blockquote>
<p>Dazu habe ich diesen Artikel gefunden:<br />
<a href="http://www.codeproject.com/vcpp/gdiplus/what_is_a_basename_.asp" rel="nofollow">http://www.codeproject.com/vcpp/gdiplus/what_is_a_basename_.asp</a></p>
<p>Aber wie zeichne ich den dann, und mit welchem dc ? Genau der Punkt fehlt in dem Beispiel, zumindest sehe ich ihn nicht.</p>
</blockquote>
<p>Also wenn ich nach CMemDC suche finde ich das:<br />
<a href="http://www.codeproject.com/gdi/flickerfree.asp" rel="nofollow">http://www.codeproject.com/gdi/flickerfree.asp</a></p>
<p>Und die Nutzung ist auch in dem Beispiel drin:</p>
<pre><code class="language-cpp">void CExampleView::OnDraw(CDC* dc)
{
    CMemDC pDC(dc);
</code></pre>
<p>Und ob nun OnDraw oder OnPaint spielt hier nun auch keine Rolle!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1227885</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1227885</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 13 Feb 2007 07:39:03 GMT</pubDate></item><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Tue, 13 Feb 2007 10:27:03 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Also wenn ich nach CMemDC suche finde ich das:<br />
<a href="http://www.codeproject.com/gdi/flickerfree.asp" rel="nofollow">http://www.codeproject.com/gdi/flickerfree.asp</a></p>
<p>Und die Nutzung ist auch in dem Beispiel drin:</p>
<pre><code class="language-cpp">void CExampleView::OnDraw(CDC* dc)
{
    CMemDC pDC(dc);
</code></pre>
</blockquote>
<p>Danke für den Hinweis. Allerdings funktioniert die zip Datei nicht, da sie fehlerhaft ist.</p>
<p>Mit folgendem Code</p>
<pre><code class="language-cpp">void CGraphCtrl::OnPaint() 
	CPaintDC dc(this); // device context for painting	

	CRect rc;
	GetClientRect(rc);

	CMemDC pDC(&amp;dc, &amp;rc);
</code></pre>
<p>funktioniert es jetzt.</p>
<p>Allerdings ist das flackern noch nicht vollständig verschwunden.<br />
Es blitzt bei jedem repaint einmal hell auf, und dass dann mehrmals (~5 Hz) pro Sekunde.</p>
<p>Woran könnte das noch liegen?</p>
<p>Der komplette Code von OnPaint ist dabei folgender</p>
<pre><code class="language-cpp">void CGraphCtrl::OnPaint() 
{
	CPaintDC dc(this); // device context for painting	

	CRect rc;
	GetClientRect(rc);

	CMemDC pDC(&amp;dc, &amp;rc);

	double value;

	if  ((m_PixelNumberX&gt;0) &amp;&amp; (m_PixelNumberY &gt; 0))
	{
		for (int ix=0; ix &lt;= m_PixelNumberX; ix++)
		{
			for (int iy=0; iy &lt;= m_PixelNumberY; iy++)
			{
				CPoint p;
				COLORREF c=0;
				// Set Value to Scale 0..1
				value=PlotData[ix][iy]/MaxValue;
				if (value&lt;0){value=0;}
				// Set Color According to settings
				c=RGB((BYTE)(value*255),(BYTE)(value*255),(BYTE)(value*255)); 
				pDC.SetPixel(getX(ix),getY(iy),c);
			}
		}
	}
}
</code></pre>
<p>Matthias</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1227953</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1227953</guid><dc:creator><![CDATA[pospiech]]></dc:creator><pubDate>Tue, 13 Feb 2007 10:27:03 GMT</pubDate></item><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Tue, 13 Feb 2007 11:47:09 GMT]]></title><description><![CDATA[<p>Ich tippe mal darauf, dass Du einfach nicht liest was in dem Artikel geschrieben steht.<br />
Hast Du einen WM_ERASEBKGND Handler eingebaut der TRUE returniert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1228023</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1228023</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 13 Feb 2007 11:47:09 GMT</pubDate></item><item><title><![CDATA[Reply to Cstatic Ausgabe flackert on Tue, 13 Feb 2007 11:59:45 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Ich tippe mal darauf, dass Du einfach nicht liest was in dem Artikel geschrieben steht.<br />
Hast Du einen WM_ERASEBKGND Handler eingebaut der TRUE returniert?</p>
</blockquote>
<p>Du meinst folgendes ?</p>
<pre><code class="language-cpp">BOOL CGraphCtrl::OnEraseBkgnd(CDC* pDC) 
{

	return FALSE;
	//return CStatic::OnEraseBkgnd(pDC);
}
</code></pre>
<p>Wobei im nächsten Artikel<br />
<a href="http://www.codeproject.com/vcpp/gdiplus/what_is_a_basename_.asp" rel="nofollow">http://www.codeproject.com/vcpp/gdiplus/what_is_a_basename_.asp</a></p>
<p>wieder genau das Gegenteil steht, nämlich dass man TRUE zurückgeben sollte.<br />
Wobei beides bei mir keinen sichtbaren Unterschied macht.</p>
<p>Matthias</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1228026</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1228026</guid><dc:creator><![CDATA[pospiech]]></dc:creator><pubDate>Tue, 13 Feb 2007 11:59:45 GMT</pubDate></item></channel></rss>