i'm 'drawing' a colored rectangle on a subclassed Richedit control using InvertRect, but everytime the region gets covered by another control it reverts to the background color.
this is the code i'm using:
Code:void PaintSelection() { // hdcMem is memory device context that i'm blitting from // to avoid flicker. // hDC is the device context of the RichEdit // rectClient is the rectangular region of the RichEdit // rectPrev is the previously highlighted region // rectCurr is the currently highlighted region BitBlt(hdcMem, 0, 0, rectClient.right - rectClient.left, rectClient.bottom - rectClient.top, hDC, 0, 0, SRCCOPY); InvertRect(hdcMem, &rectPrev); InvertRect(hdcMem, &rectCurr); BitBlt(hDC, 0, 0, rectClient.right - rectClient.left, rectClient.bottom - rectClient.top, hdcMem, 0, 0, SRCCOPY); rectPrev = rectCurr; } // WM_PAINT handler ..... case WM_PAINT: PAINTSTRUCT ps; // This calls the Default Handler to paint the screen ::CallWindowProc(m_oldProc, this->m_hWnd, uMsg, wParam, lParam); // Now it calls PaintSelection BeginPaint(m_hWnd, &ps); PaintSelection(); EndPaint(m_hWnd, &ps); return false; .....



LinkBack URL
About LinkBacks


