Gdi::CreateCompatibleBitmap_I (Windows Embedded CE 6.0)
1/6/2010
This method creates a bitmap compatible with the device associated with the specified device context.
Syntax
static WINGDIAPI HBITMAP WINAPI CreateCompatibleBitmap_I(
HDC hdc,
int nWidth,
int nHeight
);
Parameters
- hdc
[in] Handle to a device context.
- nWidth
[in] Integer that specifies the bitmap width, in pixels.
- nHeight
[in] Integer that specifies the bitmap height, in pixels.
Return Value
A handle to the bitmap indicates success.
NULL indicates failure.
To get extended error information, call GetLastError.
Remarks
This method is an internal version of the CreateCompatibleBitmap function.
The color format of the bitmap that the Gdi::CreateCompatibleBitmap_I method creates matches the color format of the device identified by the hdc parameter. You can select this bitmap into any memory device context that is compatible with the original device.
Because memory device contexts allow both color and monochrome bitmaps, the format of the bitmap that Gdi::CreateCompatibleBitmap_I returns differs when the specified device context is a memory device context.
However, a compatible bitmap that was created for a nonmemory device context always possesses the same color format and uses the same color palette as the specified device context.
If an application sets the nWidth or nHeight parameters to zero, Gdi::CreateCompatibleBitmap_I returns the handle to a 1 x 1 pixel monochrome bitmap.
If you select a device-independent bitmap (DIB) section, which is a bitmap created by the CreateDIBSection function, into the device context identified by the hdc parameter, Gdi::CreateCompatibleBitmap_I creates a DIB section.
When you no longer need the bitmap, call the Gdi::DeleteObject_I method to delete the bitmap.
Requirements
Header | gdi.hpp |
Windows Embedded CE | Windows CE .NET 4.0 and later |
See Also
Reference
Gdi
CreateCompatibleBitmap
CreateDIBSection
Gdi::DeleteObject_I
Gdi::SelectObject_I