11.2 Creating a Bitmap

You create a bitmap by supplying GDI with the dimensions and color format of the bitmap, and, optionally, the initial value of the bitmap bits. GDI then returns a handle to the bitmap. You can use this handle in subsequent GDI functions to select and display the bitmap.

You can create bitmaps in the following ways:

Use Microsoft Image Editor (IMAGEDIT.EXE) to draw the bitmap image and save it in a file. Then add the bitmap file to your application's resources. Your application loads the bitmap by using the LoadBitmap function.

Your application can first create a blank bitmap and then use GDI output functions to draw the bitmap bits.

To hard-code a bitmap, your application can create a blank bitmap and initialize its bits by using an array of bits.

Your application can create a bitmap and initialize its bits by using the image in an existing device-independent bitmap (DIB).