avoiding flickers

how can i avoid flickers?
i'm reading these tutorial: http://www.catch22.net/tuts/flicker-free-drawing
i'm trying avoid flickers without sucess :(
see my draw item message:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
case WM_ERASEBKGND:
            {
                return TRUE;
            }
            break;
            case WM_CTLCOLORSTATIC:
            {
                return (LRESULT)GetStockObject(NULL_BRUSH);
            }
            break;
            case WM_DRAWITEM:
            {

                DRAWITEMSTRUCT *test=(DRAWITEMSTRUCT*) lParam;
                image imglabel(test->rcItem.right-test->rcItem.left,test->rcItem.bottom-test->rcItem.top);
                if(inst->blnTransparent!=true)
                    FillRect(test->hDC,&test->rcItem, CreateSolidBrush(inst->clrBackColor));
                else
                    FillRect(test->hDC,&test->rcItem,(HBRUSH) GetStockObject(NULL_BRUSH));
                FillRect(imglabel,&test->rcItem,CreateSolidBrush(inst->clrBackColor));
                if(inst->imgtest.haveimage())
                    DrawHICONtoHDC(imglabel, inst->imgtest,1,1);
                SetBkMode(imglabel,TRANSPARENT);
                char *text=(char*)inst->strCaption.c_str();
                SetTextColor(imglabel,inst->clrTextColor );
                DrawTextEx(imglabel,text,-1,&test->rcItem,DT_LEFT,NULL);
                if(inst->blnBorder==true)
                    DrawEdge(imglabel, &test->rcItem,BDR_SUNKENINNER | BDR_RAISEDOUTER,BF_RECT);
                imglabel.Backcolor=inst->clrBackColor;
                TransparentBlt(test->hDC,0,0,test->rcItem.right,test->rcItem.bottom,imglabel,0,0,test->rcItem.right,test->rcItem.bottom, inst->clrBackColor);
            }
            break;

image is my class, that can read image files and do double buffer.
but even use it i get flickers. with animation, i use a timer that call:
RedrawWindow(hwnd,&d,nullptr,RDW_NOERASE | RDW_FRAME | RDW_INTERNALPAINT | RDW_NOCHILDREN);
1 - i don't use the WS_CLIPCHILDREN style, or i can lose a transparent control;
2 - i don't use the CS_VREDRAW and CS_HREDRAW class styles for trying avoid the flickers;
3 - is RedrawWindow() flag corrected for avoid flickers?
what i'm doing wrong?

Last edited on
Topic archived. No new replies allowed.