As a user-interface design decision in Container, the rectangle of a newly inserted object is updated to reflect its natural extent, as determined by the server. A container application can ignore the natural extent if, for example, you prefer to clip the object in the rectangle.
To update the rectangle of a newly inserted object to its natural extent
CContainerView::OnInsertObject
, just before the comment lines beginning with: // If item created from class list...
insert this code:
pItem->UpdateLink();
pItem->UpdateFromServerExtent();
COleClientItem::UpdateLink is called so that if the server is fully open, Container has a visual representation of the newly created item, even though the item hasn’t been changed by the user yet.
To implement smart invalidation of the newly inserted item
OnInsertObject
function, replace the following code: // TODO: reimplement selection as appropriate
// for your application
m_pSelection = pItem;
pDoc->UpdateAllViews(NULL);
with this code:
SetSelection(pItem);
pItem->InvalidateItem();