IASLabel::put_Image

This method allows a bitmapped imaged to be drawn on the control.

Syntax

HRESULT put_Image ( OLE_HANDLE hImage, OLE_HANDLE hImageMask, long dx, long dy, long dxWidth, long dyHeight );

Parameters

hImage
[in] Handle to a bitmap resource, cast to an OLE_HANDLE type.
hImageMask
[in] Handle to a bitmap mask resource, cast to an OLE_HANDLE type.
dx
[in] Specifies the x-coordinate of the left edge of the image.
dy
[in] Specifies the y-coordinate of the upper edge of the image.
dxWidth
[in] Specifies the width of the image.
dyHeight
[in] Specifies the height of the image.

Return Values

NOERROR indicates success. E_INVALIDARG indicates that the argument is invalid.

Remarks

The image mask is an optional monochrome bitmap that specifies which areas of the image are transparent. It must be the same size as the image referred to by hImage. For every black pixel in the mask, the corresponding pixel from hImage is drawn. White pixels are not drawn, and define transparent areas in the image. This function is similar in operation to BitBlt.

Because of Automation, bitmapped image pointers are passed as OLE_HANDLE types. You can cast a handle to and from a bitmap.

This method automatically repaints the control with the new bitmap.

The following code example shows how to call put_Image:

hBmp = LoadBitmapResource(hInst, MAKEINTRESOURCE(IDB_HOUSE));
hBmpMask = LoadBitmapResource(hInst, MAKEINTRESOURCE(IDB_HOUSEMASK));

pLabel -> put_Image((OLE_HANDLE) hBmp, (OLE_HANDLE) hBmpMask, 0, 0, 16, 16);