You can create bitmaps with the Image Editor. The Image Editor lets you specify the dimensions of a bitmap, then fill it in by “painting” in the blank area with such tools as a brush, spray can, and even text. Any of these tools can produce images using colors from a palette of up to 28 colors, which you can define.
To create and load a bitmap using this method, follow these steps:
1.Start the Image Editor and create the bitmap by following the directions given in Chapter 3 of the Toolkit.
2.After creating the bitmap image, save it in a file that has the filename extension .BMP.
3.In your application's resource script (.RC) file, add a BITMAP statement that defines that bitmap as an application resource.
For example, the following statement specifies that the bitmap resource named dog resides in the file DOG.BMP:
dog BITMAP DOG.BMP
The name dog identifies the bitmap; the filename DOG.BMP specifies the file that contains the bitmap.
4.In your application's source file, load the bitmap using the LoadBitmap function.
The LoadBitmap function takes the bitmap's resource name, loads the bitmap into memory, and returns a handle to the bitmap. For example, the following statement loads the bitmap resource named dog, and stores the resulting bitmap handle in the variable hDogBitmap:
hDogBitmap = LoadBitmap (hInstance, “dog”);
5.Select the bitmap into a device context using the SelectObject function.
For example, the following statement loads the bitmap specified by hDogBitmap into the device context specified by hMemoryDC:
SelectObject(hMemoryDC, hDogBitmap);
6.Display the bitmap using the BitBlt function.
For example, the following statement displays a copy of the bitmap in the memory device context hMemoryDC on the device represented by hDC:
BitBlt (hDC, 10, 10, 100, 150, hMemoryDC, 0, 0, SRCCOPY)
This example displays the bitmap beginning at location (10, 10) of the destination device context. The bitmap is 100 units wide and 150 units high. The bitmap is taken from the memory device context beginning at location (0, 0). The SRCCOPY value specifies that Windows should copy the source bitmap to the destination.