Share via


Gdi::CreateCompatibleBitmap_I (Windows CE 5.0)

Send Feedback

This method creates a bitmap compatible with the device associated with the specified device context.

static WINGDIAPI HBITMAP WINAPI CreateCompatibleBitmap_I(HDChdc, intnWidth, intnHeight);

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 Values

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

OS Versions: Windows CE .NET 4.0 and later.
Header: Gdi.hpp.

See Also

Gdi | CreateCompatibleBitmap | CreateDIBSection | Gdi::DeleteObject_I | Gdi::SelectObject_I

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.