共用方式為


COleControl::OnGetViewRect

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

virtual BOOL OnGetViewRect(
   DWORD dwAspect,
   LPRECTL pRect 
);

Parameters

  • dwAspect
    DWORD describing which form, or aspect, of an object is to be displayed. Valid values are taken from the enumeration DVASPECT or DVASPECT2:

    • DVASPECT_CONTENT   Bounding rectangle of the whole object. Top-left corner at the object's origin and size equal to the extent returned by GetViewExtent*.*

    • DVASPECT_OPAQUE   Objects with a rectangular opaque region return that rectangle. Others fail.

    • DVASPECT_TRANSPARENT   Rectangle covering all transparent or irregular parts.

  • pRect
    Points to the RECTL structure specifying the rectangle in which the object should be drawn. This parameter controls the positioning and stretching of the object.

Return Value

Nonzero if the rectangle sized to the object is successfully returned; otherwise 0.

Remarks

The object's size is converted by OnGetViewRect into a rectangle starting at a specific position (the default is the upper left corner of the display). Override this function if your control uses two-pass drawing, and its opaque and transparent parts have different dimensions.

Requirements

Header: afxctl.h

See Also

Reference

COleControl Class

Hierarchy Chart

COleControl::OnGetViewExtent

Other Resources

COleControl Members