Udostępnij za pośrednictwem


COleControl::OnGetNaturalExtent

Called by the framework in response to a container's IViewObjectEx::GetNaturalExtent request.

virtual BOOL OnGetNaturalExtent( 
   DWORD dwAspect,
   LONG lindex,
   DVTARGETDEVICE* ptd,
   HDC hicTargetDev,
   DVEXTENTINFO* pExtentInfo,
   LPSIZEL psizel  
);

Parameters

  • dwAspect
    Specifies how the object is to be represented. Representations include content, an icon, a thumbnail, or a printed document. Valid values are taken from the enumeration DVASPECT or DVASPECT2.

  • lindex
    The portion of the object that is of interest. Currently only -1 is valid.

  • ptd
    Points to the DVTARGETDEVICE structure defining the target device for which the object's size should be returned.

  • hicTargetDev
    Specifies the information context for the target device indicated by the ptd parameter from which the object can extract device metrics and test the device's capabilities. If ptd is NULL, the object should ignore the value in the hicTargetDev parameter.

  • pExtentInfo
    Points to the DVEXTENTINFO structure that specifies sizing data. The DVEXTENTINFO structure is:

    typedef struct tagExtentInfo

    {

    UINT cb;

    DWORD dwExtentMode;

    SIZEL sizelProposed;

    } DVEXTENTINFO;

    The structure member dwExtentMode can take one of two values:

    • DVEXTENT_CONTENT   Inquire how big the control should be to exactly fit content (snap-to-size)

    • DVEXTENT_INTEGRAL   When resizing, pass proposed size to control

  • psizel
    Points to sizing data returned by control. The returned sizing data is set to -1 for any dimension that was not adjusted.

Return Value

Nonzero if it successfully returns or adjusts the size; otherwise 0.

Remarks

Override this function to return the object's display size closest to the proposed size and extent mode in the DVEXTENTINFO structure. The default implementation returns FALSE and makes no adjustments to the size.

Requirements

Header: afxctl.h

See Also

Reference

COleControl Class

Hierarchy Chart

COleControl::OnGetViewExtent

Other Resources

COleControl Members