CAdUiBitmapButton::OnAutoLoad

C++

BOOL OnAutoLoad() override;

Description

This method loads the bitmap, re-calculates the bitmap image size and adjusts the button to the new image size (if m_bAutoSizeToBitmap is TRUE).

If m_bmpResId is not empty then the bitmap is loaded using the resource ID. If m_bmpResId is empty then the button's text is expected to contain a string representing the bitmap resource ID. AutoLoad then use the button's text to locate and load the bitmap resource and, if successful, will adjust the button's text to accommodate tool-tip text.

Normally, CAdUiBitmapButton responds to tool-tip text requests by supplying the button's text. AutoLoad facilitates this by replacing the button's text with the text remaining after extracting the bitmap resource ID. If the button's text contains the bitmap resource ID followed by an OR Bar then the text following the OR Bar will become the button's text after AutoLoad() is called. AutoLoad() strips the leading text up to the OR Bar, leaving the remainder as the button's text. For example, if the button was created with the text "MYBMP|My button", then after AutoLoad() the text "My button" will remain.

Note that the button's window must have been created prior to calling AutoLoad(). It's easiest to use Dynamic Data Exchange in a dialog to subclass the control and call the button's AutoLoad from the dialog's OnInitDialog(), after the dialog's base class OnInitDialog() has been called.

Links

CAdUiBitmapButton Class