如果需要在按钮中显示图标或位图,您可以用BS_ICON或BS_BITMAP风格,并用BM_SETIMAGE消息设置位图,对于BS_OWNERDRAW风格的按钮,它允许完全自由地绘制按钮。
BM_SETIMAGE
An application sends a BM_SETIMAGE message to associate a new image (icon or bitmap) with the button.
To send this message, call the SendMessage function with the following parameters.
SendMessage(
(HWND) hWnd, // handle to destination window
BM_SETIMAGE, // message to send
(WPARAM) wParam, // image type
(LPARAM) lParam // handle to the image (HANDLE)
);
Parameters
wParam
Specifies the type of image to associate with the button. This parameter can be one of the following values:
IMAGE_BITMAP
IMAGE_ICON
lParam
Handle to the image to associate with the button.
Return Values
The return value is a handle to the image previously associated with the button, if any; otherwise, it is NULL.
Remarks
Requirements
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winuser.h; include Windows.h.
See Also
Buttons Overview, Button Messages, BM_GETIMAGE