Button_GetIdealSize macro (commctrl.h)

Gets the size of the button that best fits the text and image, if an image list is present. You can use this macro or send the BCM_GETIDEALSIZE message explicitly.

Syntax

BOOL Button_GetIdealSize(
   HWND hwnd,
   SIZE *psize
);

Parameters

hwnd

Type: HWND

A handle to the button control.

psize

Type: SIZE*

A pointer to a SIZE structure that receives the desired size of the button including the text and image list if present.

Return value

Type: BOOL

If the macro succeeds, it returns TRUE. Otherwise it returns FALSE.

Remarks

This macro is most applicable to PushButtons. When sent to a PushButton, the macro retrieves the bounding rectangle required to display the button's text. And, if the PushButton has an image list, the bounding rectangle is also sized to include the button's image.

When sent to a button of any other type, the size of the control's window rectangle is retrieved.

Note  To use this macro, you must provide a manifest specifying Comctl32.dll version 6.0. For more information on manifests, see Enabling Visual Styles.
 

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header commctrl.h

See also

BCM_GETIDEALSIZE

Other Resources

Reference

SIZE