Hi,
well I have a usual dialog based application with a resizable dialog. Because I have some regions which gonna be transparent, I make in the OnInitDialog the following call:
The MFC (or whoever) makes a not so funny black painting of the region which will be bigger then the initial dialog. Without calling 'SetLayeredWindowAttributes' the black painting is not happend.Code:const COLORREF crTransparent = RGB( 255, 0, 0 ); LONG dwNewLong = GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED; SetWindowLong(m_hWnd, GWL_EXSTYLE, dwNewLong); SetLayeredWindowAttributes( crTransparent, 0, LWA_COLORKEY);
I tried to override the erase of background like this:
but ... no chance, they are ... almighty. First apears the black painting, then my green solid rect.Code:BOOL CBlaBlaTestDlg::OnEraseBkgnd(CDC* pDC) { CRect rect; GetWindowRect(&rect); // Erase the area needed ScreenToClient(&rect); pDC->FillSolidRect(&rect, RGB(0,255,0)); return TRUE; }
Has anyone, any idea how can I avoid this black painting ???
Thanks in advance!
Best regards,
Emil




Reply With Quote