To get the extent of the CContainerItem
object from the server, and update the m_rect
of the container item, implement the helper function CContainerItem::UpdateFromServerExtent
.
To get the extent of a CContainerItem object
CContainerItem
.void
.UpdateFromServerExtent()
CSize size;
if (GetCachedExtent(&size))
{
// OLE returns the extent in HIMETRIC units -- we need pixels
CClientDC dc(NULL);
dc.HIMETRICtoDP(&size);
// only invalidate if it has actually changed and also only
// if it is not in-place active.
if (size != m_rect.Size() && !IsInPlaceActive())
{
// invalidate old, update, invalidate new
InvalidateItem();
m_rect.bottom = m_rect.top + size.cy;
m_rect.right = m_rect.left + size.cx;
InvalidateItem();
// mark document as modified
GetDocument()->SetModifiedFlag();
}
}