I recently needed to revisit this to create simple monochrome bitmaps representing the sets of nozzles turned off/on on a Xaar microarrayer printhead. Sample code here . Essential steps are outlined in the following code [code language="cpp"] // 1. Create the uninitialized bitmap, that is compatible // with the the specified device context CPaintDC dc( this ); CBitmap bitmap; bitmap.CreateCompatibleBitmap( &dc, 20, 20 ); // 2. Create memory device context, that is compatible // with the specified device (dc in this case) CDC dcMem; dcMem.CreateCompatibleDC( &dc ); // 3. Obtain/create the bitmap and select into // the memory device context. CBrush brushblue( RGB( 0, 0, 255 ) ); CBrush brush( RGB( 0, 255, 255 ) ); CBitmap* pOldBitmap = dcMem.SelectObject( &bitmap ); dcMem.FillRect( CRect( 0, 0, 10, 10 ), &brushblue ); dcMem.FillRect( CRect( 10, 0, 20, 10 ), &brush ); dcMem.FillRect( CRect( 0, 10, 10, 20 ), &brush ); dcMem.FillRect( CRect(...