|
-
December 9th, 2002, 01:41 PM
#1
Rich Edit and WM_PRINT
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:
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);
}
It doesn't work (I tried with riched v1 and v2). Does anyone have an idea how to do this?
regards,
MiMec
-
December 9th, 2002, 04:35 PM
#2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|