答案其实很简单:msdn的原文"When the memory device context is created, its display surface is exactly one monochrome pixel wide and one monochrome pixel high"
意思是:当内存dc被创建时,它的显示面只有单色和1个象素的宽和高
CreateCompatibleBitmap创建dc兼容位图,内存dc是单色的,所以...
试试CreateCompatibleBitmap(GetDC(),width,height)应该可以,详情请参阅
MSDN,摘录如下:
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.