cambalinho 125 Practically a Posting Shark

by several reasons, i must create the static with it's paint message:

case WM_PAINT:
            {
                PAINTSTRUCT  ps;
                HDC hdc = BeginPaint(inst->hwnd, &ps);
                if(inst->Paint==NULL)
                {
                    RECT f;
                    GetClientRect(hwnd,&f);
                    HBRUSH s=CreateSolidBrush(inst->clrBackColor);
                    SelectObject(hdc,(HBRUSH)s);
                    if (inst->clrBackColor==-1)
                    {
                        //hide, copy the parent control and show the control again
                        ShowWindow(inst->hwnd,SW_HIDE);
                        BitBlt(hdc,0,0,f.right-f.left,f.bottom-f.top,GetDC(GetParent(inst->hwnd)),inst->intLeft,inst->intTop,SRCCOPY);
                        ShowWindow(inst->hwnd,SW_SHOW);
                    }
                    else
                        FillRect(hdc,&f,s);
                    SetBkMode(hdc,TRANSPARENT);
                    char *text=(char*)inst->strCaption.c_str();
                    SetTextColor(hdc,inst->clrTextColor );
                    DrawTextEx(hdc,text,-1,&f,DT_CENTER,NULL);
                    DeleteObject(s);
                }
                else
                    inst->Paint(inst->hwnd,hdc);
                EndPaint(inst->hwnd, &ps);
            }
            break;

i can't use the WS_EX_TRANSPARENT style, because when i call the InvalidateRect()(and the parent have the WS_CLIPCHILDREN style), the static control is never showed. so i did it using the WM_PAINT message.
but when it's transparent i can't copy tthe parent HDC with BitBlt() :(
what i'm doing wrong?
(it's called a false transparent)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.