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