按照msdn上将:
设备环境:
A device context is a structure that defines a set of graphic objects and their associated attributes, as well as the graphic modes that affect output. The graphic objects include a pen for line drawing, a brush for painting and filling, a bitmap for copying or scrolling parts of the screen, a palette for defining the set of available colors, a region for clipping and other operations, and a path for painting and drawing operations. 
位图:
The bitmap has the same number of color planes or the same bits-per-pixel format as the specified device context. It can be selected as the current bitmap for any memory device that is compatible with the one specified by pDC.If pDC is a memory device context, the bitmap returned has the same format as the currently selected bitmap in that device context. A "memory device context" is a block of memory that represents a display surface. It can be used to prepare images in memory before copying them to the actual display surface of the compatible device.When a memory device context is created, GDI automatically selects a monochrome stock bitmap for it.Since a color memory device context can have either color or monochrome bitmaps selected, the format of the bitmap returned by the CreateCompatibleBitmap function is not always the same; however, the format of a compatible bitmap for a nonmemory device context is always in the format of the device.When you finish with the CBitmap object created with the CreateCompatibleBitmap function, first select the bitmap out of the device context, then delete the CBitmap object.
Note: When a memory device context is created, it initially has a 1-by-1 monochrome bitmap selected into it. If this memory device context is used in CreateCompatibleBitmap, the bitmap that is created is a monochrome bitmap. [color=#FF6600]To create a color bitmap, use the hDC that was used to create the memory device context, as shown in the following code:
[/color]
    HDC memDC = CreateCompatibleDC ( hDC );
    HBITMAP memBM = CreateCompatibleBitmap ( hDC, nWidth, nHeight );
    SelectObject ( memDC, memBM );

解决方案 »

  1.   

    设备环境大概就是一套准备好某种样式的笔、刷子、字体、文字背景模式的环境,其中也包括位图,上面提到创建兼容DC时,默认准备了一张1像素宽1像素高的单色位图。
    你绘制东西需要DC里有位图,就像画画有了笔,还需要画纸一样。你创建一个兼容位图,是用来准备一张你需要的大小、颜色模式的“画纸”,不然在那张默认的那个1像素大小的单色位图上你也做不了太多事情。
      

  2.   

    LZ牛的话,可以自己与驱动交互,实现绘图
    但是没有那么多牛人,
    所以就有了DC,
    你只需要把你的意图给它就OK了,它帮你实现绘图。