
gets the handle of the bitmap in the Clipboard and constructs a bitmap
object from the handle:
TBitmap(const TClipboard& clipboard);
T create a bitmap from a metafile, you need to pass a TMetaFilePict &, ao
TPalette &, and a TSize &. The constructor initializes a device-compatible
bitmap (based on the palette) and plays the metafile into the bitmap:
TBitmap(const TMetaFilePict& metaFile, TPalette& palette, const TSize& size);
T create a bitmap from a device-independent bitmap, you need to pass ao
TDib & to the constructor Y u can also specify an optional palette. The. o
constructor creates a device context and renders the DIB into a device-
compatible bitmap:
TBitmap(const TDib& dib, const TPalette* palette = 0);
Y u can create a bitmap object by loading it from a module. Thiso
constructor takes two parameters, first the HINST NCE of the moduleA
containing the bitmap and second the resource ID of the bitmap you want
to load:
TBitmap(HINSTANCE, TResId);
Y u can also create a new TBitmap object from an existing HBITMAPo
handle:
TBitmap(HBITMAP handle, TAutoDelete autoDelete = NoAutoDelete);
This constructor is used to obtain an ObjectWindows object as an alias to a
regular Windows handle received in a message.
Y u can access TBitmap through an HBITMAP or as a BITMAP structure.o
Accessing
T get an HBITMAP from a TBitmap object, use the HBITMAP operatoro
TBitmap
with the TBitmap object as the parameter The HBITMAP operator is almost.
never explicitly invoked:
HBITMAP GetHBitmap(TBitmap &bitmap)
{
return bitmap;
}
This code automatically invokes the HBITMAP conversion operator to cast
the TBitmap object to the correct type.
T convert a TBitmap object to a BITMAP structure, use the GetObjecto
function:
308
OWL P ogrammer’ Guider s