11.3 Displaying a Bitmap

Windows provides several ways to display a bitmap:

Display a memory bitmap by using the BitBlt function to copy the bitmap from the memory device context to a screen.

Use the StretchBlt function to copy a stretched or compressed bitmap from a memory device context to a screen.

Use the CreatePatternBrush function to create a brush that incorporates the bitmap. Any subsequent GDI functions that use the brush, such as PatBlt, will display that bitmap.

Use the SetDIBitsToDevice function to display a device-independent bitmap directly on the output device.

Display the bitmap as a menu item in a menu by replacing the original menu-item text, defined in the .RC file, with the bitmap. The user can then choose the command associated with the menu item to carry out an action. For information about replacing a menu item with a bitmap, see Chapter 7, “Menus.”