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. Blinking effect in Cwnd child window

Blinking effect in Cwnd child window

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicsquestion
3 Posts 2 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.
  • A Offline
    A Offline
    aragornx
    wrote on last edited by
    #1

    Hello I've got problem with blinking window. My application is multi-doc one. One of my view is simple CView with drawing code in OnPaint. This view is repainting every second (when new data is arriving). From this view I'm creating new window which is a child to my current view's frame. Class of this "child" window is inherited by CWnd class. Unfortunately whan my CView is repainting the top window (child window) is blinking. I've used double-buffering technique - and nothing - still the same problem. Here is my code's samples: 1. Making window: void CBigValueEdit::setVisible( bool b ) { if ( b == true ) { if (this->Create( NULL, _T("Test;"), WS_CHILDWINDOW | WS_VISIBLE | WS_BORDER | WS_CAPTION , rect, parent, IDW_BIG_VALUE ) != 0 ) { this->ShowWindow( SW_SHOW ); this->SetFocus(); visible = true; calcRects(); setDigitVal(); } } else { // wyłącz okienko visible = false; this->ShowWindow( SW_HIDE ); this->DestroyWindow(); } } 2. Double-buffering: if ( bmpCreated == false ) { bmpBufor.CreateCompatibleBitmap( dc, rect.Width(), rect.Height() ); vdc.CreateCompatibleDC( dc ); vdc.SelectObject( bmpBufor ); bmpCreated = true; } [...] dc->BitBlt( 0, 0, rect.Width(), rect.Height(), &vdc, 0, 0, SRCCOPY ); 3. Making window from main CView class: ed.setTitle("Set high alarm :"); ed.setRectangle( rect ); ed.setFormat(4,2); ed.setValue( selectedCounter->getAlarmLowValue() ); ed.setVisible( true ); ed - my class inherited by CWnd... What;s wrong Where's the catch? Please - help me... -=AragornX=-

    O 1 Reply Last reply
    0
    • A aragornx

      Hello I've got problem with blinking window. My application is multi-doc one. One of my view is simple CView with drawing code in OnPaint. This view is repainting every second (when new data is arriving). From this view I'm creating new window which is a child to my current view's frame. Class of this "child" window is inherited by CWnd class. Unfortunately whan my CView is repainting the top window (child window) is blinking. I've used double-buffering technique - and nothing - still the same problem. Here is my code's samples: 1. Making window: void CBigValueEdit::setVisible( bool b ) { if ( b == true ) { if (this->Create( NULL, _T("Test;"), WS_CHILDWINDOW | WS_VISIBLE | WS_BORDER | WS_CAPTION , rect, parent, IDW_BIG_VALUE ) != 0 ) { this->ShowWindow( SW_SHOW ); this->SetFocus(); visible = true; calcRects(); setDigitVal(); } } else { // wyłącz okienko visible = false; this->ShowWindow( SW_HIDE ); this->DestroyWindow(); } } 2. Double-buffering: if ( bmpCreated == false ) { bmpBufor.CreateCompatibleBitmap( dc, rect.Width(), rect.Height() ); vdc.CreateCompatibleDC( dc ); vdc.SelectObject( bmpBufor ); bmpCreated = true; } [...] dc->BitBlt( 0, 0, rect.Width(), rect.Height(), &vdc, 0, 0, SRCCOPY ); 3. Making window from main CView class: ed.setTitle("Set high alarm :"); ed.setRectangle( rect ); ed.setFormat(4,2); ed.setValue( selectedCounter->getAlarmLowValue() ); ed.setVisible( true ); ed - my class inherited by CWnd... What;s wrong Where's the catch? Please - help me... -=AragornX=-

      O Offline
      O Offline
      Optimus Chaos
      wrote on last edited by
      #2

      Have you responded to WM_ERASEBKGND? If you are using double buffering you should respond to this message ans return TRUE, to tell Windows that the background has been erased, otherwise Windows will erase the background with the default brush defined in the windows class.

      A 1 Reply Last reply
      0
      • O Optimus Chaos

        Have you responded to WM_ERASEBKGND? If you are using double buffering you should respond to this message ans return TRUE, to tell Windows that the background has been erased, otherwise Windows will erase the background with the default brush defined in the windows class.

        A Offline
        A Offline
        aragornx
        wrote on last edited by
        #3

        It didn't help... The unwanted effect is that the background window(parent) is in one moment drawn over the child window...

        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