Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to make flicker free dialog interface?

How to make flicker free dialog interface?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    subj. I try: void CTest::OnPaint() { CPaintDC dc(this); CMemDC memdc(&dc); CRect clip; memdc.GetClipBox(&clip); memdc.FillSolidRect(clip, GetSysColor (COLOR_3DLIGHT)); DefWindowProc(WM_PAINT, (WPARAM)memdc->m_hDC, (LPARAM)0); } BOOL CTestDlg::OnEraseBkgnd(CDC* pDC) { return FALSE; } but anyway my *picture control* flickering and after max/min window's size flicks too. Even more when I open any file by CFileDialog my controls aren't repainted. What's wrong?

    M C T 3 Replies Last reply
    0
    • L Lost User

      subj. I try: void CTest::OnPaint() { CPaintDC dc(this); CMemDC memdc(&dc); CRect clip; memdc.GetClipBox(&clip); memdc.FillSolidRect(clip, GetSysColor (COLOR_3DLIGHT)); DefWindowProc(WM_PAINT, (WPARAM)memdc->m_hDC, (LPARAM)0); } BOOL CTestDlg::OnEraseBkgnd(CDC* pDC) { return FALSE; } but anyway my *picture control* flickering and after max/min window's size flicks too. Even more when I open any file by CFileDialog my controls aren't repainted. What's wrong?

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      For a start, handle WM_ERASEBKGND, not WM_PAINT. --Mike-- http://home.inreach.com/mdunn/ We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....

      L 1 Reply Last reply
      0
      • M Michael Dunn

        For a start, handle WM_ERASEBKGND, not WM_PAINT. --Mike-- http://home.inreach.com/mdunn/ We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Move all WM_PAINT code to WM_ERASEBKGND? or what?

        M 1 Reply Last reply
        0
        • L Lost User

          Move all WM_PAINT code to WM_ERASEBKGND? or what?

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          Yes. Since you are painting a custom background color, do it in WM_ERASEBKGND. --Mike-- http://home.inreach.com/mdunn/ We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....

          L 1 Reply Last reply
          0
          • L Lost User

            subj. I try: void CTest::OnPaint() { CPaintDC dc(this); CMemDC memdc(&dc); CRect clip; memdc.GetClipBox(&clip); memdc.FillSolidRect(clip, GetSysColor (COLOR_3DLIGHT)); DefWindowProc(WM_PAINT, (WPARAM)memdc->m_hDC, (LPARAM)0); } BOOL CTestDlg::OnEraseBkgnd(CDC* pDC) { return FALSE; } but anyway my *picture control* flickering and after max/min window's size flicks too. Even more when I open any file by CFileDialog my controls aren't repainted. What's wrong?

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Micahel is absolutely right, but I'll also point out that when you call CPaintDC the screen is blanked, so if you ever have to draw anything in OnPaint and have trouble with flicker, don't create your PaintDC until you're about to copy the memDC over the top of it. Otherwise you may stop tearing, but you won't do a thing about flicker. Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.

            1 Reply Last reply
            0
            • M Michael Dunn

              Yes. Since you are painting a custom background color, do it in WM_ERASEBKGND. --Mike-- http://home.inreach.com/mdunn/ We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              >We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see >if anyone notices.... I thought MSDN online seemed a bit quicker than normal!

              1 Reply Last reply
              0
              • L Lost User

                subj. I try: void CTest::OnPaint() { CPaintDC dc(this); CMemDC memdc(&dc); CRect clip; memdc.GetClipBox(&clip); memdc.FillSolidRect(clip, GetSysColor (COLOR_3DLIGHT)); DefWindowProc(WM_PAINT, (WPARAM)memdc->m_hDC, (LPARAM)0); } BOOL CTestDlg::OnEraseBkgnd(CDC* pDC) { return FALSE; } but anyway my *picture control* flickering and after max/min window's size flicks too. Even more when I open any file by CFileDialog my controls aren't repainted. What's wrong?

                T Offline
                T Offline
                Tommy H D Svensson
                wrote on last edited by
                #7

                I don't understand this piece of code... Where do you get CMemDC from? I don't have it? :( Also, why are you not calling BitBlt to eliminate flickering? Thx, /Tommy

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups