I've implemented the CMemDC in my derived CFormView class. I have no special drawing to do so in the OnDraw implementation I called CFormView::OnDraw(pDC).
The screen continue to flicker and the background become white (instead of gray).
What should I do if I have NO special drawing in my derived CFormView class?
I have serious problems with flickering in my Dialog based application. Simply I must draw (every 100 ms about) some rectangles, so I wrote the code to paint these rectangles in the OnPaint method (member of my sub-class Cdialog type). How I can resolve my problem?
Thank you very much.
When you pass a DC using pCDC = pWnd->GetDC(); to the CMemDC constructor there will be a memory leak, because the pCDC wont be released (pWnd->ReleaseDC(pCMemDC); wont release the pCDC). So what i've done to fix this is the following:
CDC* pCDC = &pCCDC;
and then passing this pCDC with the CMemDC constructor. CClientDC gets released automatically.
Hope that helps some people, took me a while to find this one.
If i wanna pass a CPaintDC variable to the construtor of the CMemDC,there'll incur a problem in the line pDC->GetClipBox.If you use CMemDC in your CYourClass::OnPaint,in this function a CPaintDC variable is constructed,which is generated by MFC Appwizard.You know after call of the constructor,there is no any clip box.So that line of code will get a NULL rectangle.As a result the subsequent code will also work improperly.
i read with interest about reducing the flicker on resizing and dragging - which has been bugging me in my app. but what really bugs me is that i get flicker as the app updates the contents of my grid control. i populate a grid control (msflexgrid) with data from a list of objects (all the same kind). when i get an update to an object, i call updateallviews to get the ondraw function to loop through the list of objects and update the values in the grid. but i think the actual grid itself is being redrawn each time, and not the individual cells. i wouldn;t mind about the flickering during resizing, as i don;t resize it much, but with lots of entries in the grid needing to be changed every couple of seconds, it's going to give me epilepsy or something.
can you help? i suspect it;s the way i use updateallviews to cause the view to update itself.