I've a CWnd (parent) which holds a grid control that allows to paint some items on it. The problem is that I wanna draw some sophisticated CWnds on it but grid control only allows to paint items that are deriving from "ItemBase" class which has nothing to do with CWnd.
This ItemBase class allows to override a virtual function void drawItem(CDC *, CRect) which allows to paint own drawings on provided CDC and in clipped reagion CRect.
The idea I have is to create my sophisticated CWnds as invisible children of parent window and then, in drawItem of ItemBase use CWnd::Paint on provided CDC.
So what I do is:
- I've a grid control.
- I create set of sophisticated windows
- I create (for each sophisticated window) an object of class that derives from ItemBase
- I add set of objects of base type ItemBase to grid control
In drawItem(CDC *dc, CRect area) I call:
m_sophisticatedWindow->MoveWindow(area); //move window on proper place m_sophisticatedWindow->Print(dc, PRF_CLIENT); //render it
So i'm expecting that In proper places of grind control a proper sophisticated windows will be painted, however nothing happens. I've tried using PrintClient/PrintWindow instead of Print. I was also doing experiments with MoveWindow - like changing position to some fixed positions but it doesn't help.
If I paint anything directly on CDC in drawItem (like lines, points etc) - everything is fine, just Print function doesn't seem doing what I expect it does.
Any clues?