I am currently trying to subclass a CRichEditCtrl
in my application. This is the subclass class:
class FileEdit : public CWindowImpl<FileEdit, CRichEditCtrl>
{
DECLARE_WND_CLASS(L"FileEdit");
public:
BEGIN_MSG_MAP_EX(FileEdit)
MSG_WM_PAINT(OnPaint)
MSG_WM_LBUTTONUP(OnLButtonUp)
END_MSG_MAP()
bool Init();
private:
void OnPaint(CDCHandle dc);
void OnLButtonUp(UINT nFlags, CPoint point);
};
My paint method looks like this:
void FileEdit::OnPaint(CDCHandle dc)
{
PAINTSTRUCT ps;
if (!dc)
{
dc = BeginPaint(&ps);
}
POINT p[2];
p[0].x = 1;
p[0].y = 1;
p[1].x = 5;
p[1].y = 5;
Polygon(dc, p, 2);
EndPaint(&ps);
}
This does indeed draw the polygon I want, but that is the only thing it does paint, as well. I am pretty sure why this is happening. I am accepting the Paint message, I am handling it, and then it is done. I don't go through the default routine which would paint the background white for example.
However, I would actually like to have it like this:
- Go through the default paint routine, which would happen, if I don't specify a custom paint routine
- Paint the things I request in
FileEdit::OnPaint
-method.
I still want the usual paint routine, but I just want to add a few things "on top" afterwards.
Is there any way to accomplish this? Maybe I could pass the PAINTSTRUCT
to a base method?
Thanks in advance