CMFCToolBarButton::OnCalculateSize

Called by the framework to calculate the size of the button for the specified device context and docking state.

virtual SIZE OnCalculateSize(
   CDC* pDC,
   const CSize& sizeDefault,
   BOOL bHorz 
);

Parameters

  • [in] pDC
    The device context that displays the button.

  • [in] sizeDefault
    The default size of the button.

  • [in] bHorz
    The dock state of the parent toolbar. This parameter is TRUE if the toolbar is docked horizontally or is floating, or FALSE if the toolbar is docked vertically.

Return Value

A SIZE structure that contains the dimensions of the button, in pixels.

Remarks

The framework calls this method to determine the size of the toolbar button for the specified device context and dock state.

The default implementation considers the text and image sizes (if they are displayed), the text and image positions (the text below or at the right-hand side of the image), and the toolbar dock state.

Override this method if you want to provide the size of a non-standard button (for example, an edit box button).

Requirements

Header: afxtoolbarbutton.h

See Also

Reference

CMFCToolBarButton Class

Hierarchy Chart