I have a rich edit control and I want to add some kind of a selection bar on the left side of it. I need to paint this bar on my own (gray background, images etc.).
The problem is that the rich edit control doesn't seem to handle the WM_PRINT / WM_PRINTCLIENT messages properly. I tried to override the OnPaint function, render the control to a bitmap in memory and paint the bar:
It doesn't work (I tried with riched v1 and v2). Does anyone have an idea how to do this?Code:CMyRichEditCtrl::OnPaint() { CPaintDC dc(this); CRect rcClient; GetClientRect(&rcClient); CDC dcMem; dcMem.CreateCompatibleDC(&dc); CBitmap bmpMem; bmpMem.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height()); dcMem.SelectObject(&bmpMem); SendMessage(WM_PRINT, (WPARAM)dcMem.m_hDC, PRF_CLIENT | PRF_ERASEBKGND); rcClient.right = 16; dcMem.FillSolidRect(&rcClient, RGB(192,192,192)); dc.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), &dcMem, 0, 0, SRCCOPY); }




Reply With Quote