CButton.SetImageListmethod
Assigns an image list to a button control.
Syntax
FUNCTION SetImageList (BYVAL hButton AS HWND, BYVAL pbuttonImagelist AS BUTTON_IMAGELIST PTR) AS BOOLEAN
FUNCTION SetImageList (BYVAL hButton AS HWND, BYVAL himl AS HIMAGELIST, BYVAL nLeft AS LONG, BYVAL nTop AS LONG, BYVAL nRight AS LONG, BYVAL nBottom AS LONG, BYVAL uALign AS UINT = 0) AS BOOLEAN
Parameters
| Name | Description | |
|---|---|---|
hButton | The handle to the button control. | |
pbuttonImagelist | A pointer to a BUTTON_IMAGELIST structure that contains image list information. | |
hButton | The handle to the button control. | |
hImageList | The handle to the image list. | |
nLeft | The x-coordinate of the upper-left corner of the rectangle for the image. | |
nTop | The y-coordinate of the upper-left corner of the rectangle for the image. | |
nRight | The x-coordinate of the lower-right corner of the rectangle for the image. | |
nBottom | The y-coordinate of the lower-right corner of the rectangle for the image. | |
uAlign | The alignment to use. This parameter can be one of the following values: |
Return value
If the message succeeds, it returns TRUE. Otherwise it returns FALSE.
Description
Assigns an image list to a button control.
The default value is BUTTON_IMAGELIST_ALIGN_LEFT.
Remarks
To use this message, you must provide a manifest specifying Comclt32.dll version 6.0.
The image list referred to in the himl member of the BUTTON_IMAGELIST structure should contain either a single image to be used for all states or individual images for each state. The following states are defined in vssym32.h. Note that PBS_STYLUSHOT is used only on tablet computers.
Each value is an index to the appropriate image in the image list. If only one image is present, it is used for all states. If the image list contains more than one image, each index corresponds to one state of the button. If an image is not provided for each state, nothing is drawn for those states without images.
Example
enum PUSHBUTTONSTATES {
PBS_NORMAL = 1,
PBS_HOT = 2,
PBS_PRESSED = 3,
PBS_DISABLED = 4,
PBS_DEFAULTED = 5,
PBS_STYLUSHOT = 6,
};
Reference
- Include file
CButton.inc - Defined in AfxNova/CButton.inc:207
- Documented in Windows/WIndows Controls/CButton Class.md
- Topic: CButton Class