<?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[Probleme mit Double Buffering]]></title><description><![CDATA[<p>Hallo!</p>
<p>Beim Zeichnen meiner eigenen ToolBar habe ich Probleme mit dem double buffering.<br />
Wenn ich &quot;herkömmlich&quot; ein ButtonRect beim Mouseover zeichne flackert es. Nun habe ich mir gedacht: Mit double buffering wird nichts mehr flackern und mir kurzerhand eine vorläufige Miniklasse namen CMemDC erstellt. Nun flackert zwar nichts mehr, aber wenn ich nur ein ButtonRect mit double buffering zeichne (genauso wie ohne) flackert es zwar nicht mehr, aber andere Bereiche sind komplett schwarz. Da ich leider kaum Ahnung von Zeichengelumpe habe, fände ich es klasse wenn mir jemand einen Tip geben könnte. Hier der Source der CMemDC:</p>
<pre><code class="language-cpp">namespace GUIHelper
{
    class CMemDC : public ::CDC
    {
    private:

        ::RECT    *m_prc;
        ::CDC     *m_pDC;
        ::CBitmap *m_pOldBitmap;
        ::CBitmap  m_MemBitmap;

    public:

        CMemDC()
            : m_prc(0), m_pDC(0), m_pOldBitmap(0)
        {}

        CMemDC(::CDC &amp;dc, ::RECT &amp;rc)
            : m_prc(0), m_pDC(0), m_pOldBitmap(0)
        {
            this-&gt;m_prc = &amp;rc;
            this-&gt;m_pDC = &amp;dc;
            CreateMemDC(dc, rc);
        }

        ~CMemDC()
        {
            this-&gt;m_prc = 0;
            this-&gt;m_pDC = 0;
            this-&gt;m_pOldBitmap = 0;
        }

        bool CreateMemDC(CDC &amp;dc, ::RECT &amp;rc)
        {
            this-&gt;m_prc = &amp;rc;
            this-&gt;m_pDC = &amp;dc;

            if (!CDC::CreateCompatibleDC(&amp;dc))
                return false;

            if (!this-&gt;m_MemBitmap.CreateCompatibleBitmap(this-&gt;m_pDC, this-&gt;m_prc-&gt;right, this-&gt;m_prc-&gt;bottom))
                return false;

            this-&gt;m_pOldBitmap = ::CDC::SelectObject(&amp;this-&gt;m_MemBitmap);

            return true;
        }

        bool BendBackToDC(void)
        {
            if (!this-&gt;m_pDC-&gt;BitBlt(0, 0, this-&gt;m_prc-&gt;right, this-&gt;m_prc-&gt;bottom, this, 0, 0, SRCCOPY))
                return false;

            ::CDC::SelectObject(this-&gt;m_pOldBitmap);

            return true;
        }
    };
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/152343/probleme-mit-double-buffering</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Jul 2026 17:39:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/152343.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 05 Jul 2006 13:55:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit Double Buffering on Wed, 05 Jul 2006 13:55:24 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Beim Zeichnen meiner eigenen ToolBar habe ich Probleme mit dem double buffering.<br />
Wenn ich &quot;herkömmlich&quot; ein ButtonRect beim Mouseover zeichne flackert es. Nun habe ich mir gedacht: Mit double buffering wird nichts mehr flackern und mir kurzerhand eine vorläufige Miniklasse namen CMemDC erstellt. Nun flackert zwar nichts mehr, aber wenn ich nur ein ButtonRect mit double buffering zeichne (genauso wie ohne) flackert es zwar nicht mehr, aber andere Bereiche sind komplett schwarz. Da ich leider kaum Ahnung von Zeichengelumpe habe, fände ich es klasse wenn mir jemand einen Tip geben könnte. Hier der Source der CMemDC:</p>
<pre><code class="language-cpp">namespace GUIHelper
{
    class CMemDC : public ::CDC
    {
    private:

        ::RECT    *m_prc;
        ::CDC     *m_pDC;
        ::CBitmap *m_pOldBitmap;
        ::CBitmap  m_MemBitmap;

    public:

        CMemDC()
            : m_prc(0), m_pDC(0), m_pOldBitmap(0)
        {}

        CMemDC(::CDC &amp;dc, ::RECT &amp;rc)
            : m_prc(0), m_pDC(0), m_pOldBitmap(0)
        {
            this-&gt;m_prc = &amp;rc;
            this-&gt;m_pDC = &amp;dc;
            CreateMemDC(dc, rc);
        }

        ~CMemDC()
        {
            this-&gt;m_prc = 0;
            this-&gt;m_pDC = 0;
            this-&gt;m_pOldBitmap = 0;
        }

        bool CreateMemDC(CDC &amp;dc, ::RECT &amp;rc)
        {
            this-&gt;m_prc = &amp;rc;
            this-&gt;m_pDC = &amp;dc;

            if (!CDC::CreateCompatibleDC(&amp;dc))
                return false;

            if (!this-&gt;m_MemBitmap.CreateCompatibleBitmap(this-&gt;m_pDC, this-&gt;m_prc-&gt;right, this-&gt;m_prc-&gt;bottom))
                return false;

            this-&gt;m_pOldBitmap = ::CDC::SelectObject(&amp;this-&gt;m_MemBitmap);

            return true;
        }

        bool BendBackToDC(void)
        {
            if (!this-&gt;m_pDC-&gt;BitBlt(0, 0, this-&gt;m_prc-&gt;right, this-&gt;m_prc-&gt;bottom, this, 0, 0, SRCCOPY))
                return false;

            ::CDC::SelectObject(this-&gt;m_pOldBitmap);

            return true;
        }
    };
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1091835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1091835</guid><dc:creator><![CDATA[HaJo.]]></dc:creator><pubDate>Wed, 05 Jul 2006 13:55:24 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Double Buffering on Wed, 05 Jul 2006 14:13:53 GMT]]></title><description><![CDATA[<p>Als MemDC empfehle ich immer und immer wieder den hier:<br />
<a href="http://www.codeproject.com/gdi/flickerfree.asp" rel="nofollow">http://www.codeproject.com/gdi/flickerfree.asp</a></p>
<p>Ist denke ich das beste du übernimmst einfach den MemDC <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1091853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1091853</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Wed, 05 Jul 2006 14:13:53 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Double Buffering on Wed, 05 Jul 2006 14:37:03 GMT]]></title><description><![CDATA[<p>Dravere schrieb:</p>
<blockquote>
<p>Als MemDC empfehle ich immer und immer wieder den hier:<br />
<a href="http://www.codeproject.com/gdi/flickerfree.asp" rel="nofollow">http://www.codeproject.com/gdi/flickerfree.asp</a></p>
</blockquote>
<p>Super. Es klappt schonmal danke.</p>
<p>Dravere schrieb:</p>
<blockquote>
<p>Ist denke ich das beste du übernimmst einfach den MemDC <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
</blockquote>
<p>Ich werde mir mal den Code anschauen und meinen Fehler suchen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1091875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1091875</guid><dc:creator><![CDATA[HaJo.]]></dc:creator><pubDate>Wed, 05 Jul 2006 14:37:03 GMT</pubDate></item></channel></rss>