The framework provides a mechanism for invalidating portions of a view by using the lHint and pHint parameters of CView::OnUpdate. This “update hint” mechanism is described in the Scribble tutorial and is used in Container.
To receive the hint and invalidate the view
OnUpdate function declaration to CContainerView.h and a starter function definition to CContainerView.cpp.OnUpdate by replacing the //TODO comment with the following code:switch (lHint)
{
case HINT_UPDATE_WINDOW:    // invalidate entire window
Invalidate();
break;
case HINT_UPDATE_ITEM:        // invalidate single item
{
CRectTracker tracker;
SetupTracker((CContainerItem*)pHint, &tracker);
CRect rect;
tracker.GetTrueRect(rect);
InvalidateRect(rect);
}
break;
}
The rectangle to be invalidated for HINT_UPDATE_ITEM should include the area that might be occupied by a tracker around the object. The implementation of CContainerView::OnUpdate takes this into account.