When the fully opened server (for example, HIERSVR) notifies the container about a change (a new node) that affects the natural extent of the object, the CContainerItem
rectangle needs to be updated.
To update the CContainerItem rectangle when the item’s natural extent changes
OnChange
in CContainerItem
and replace the lines starting with //TODO with the following code: switch (nCode)
{
case OLE_CHANGED:
InvalidateItem();
UpdateFromServerExtent();
break;
case OLE_CHANGED_STATE:
case OLE_CHANGED_ASPECT:
InvalidateItem();
break;
}
Notice that the CContainerItem
object has to be invalidated whenever the server sends a notification that the object has changed. The constant values that nCode
can assume are defined by the framework.