十二月 2005
由 Jianing Yang 于 星期四, 2005-12-22 22:37 发表
之前我创建的CompatibleBitmap是使用memDC来创建的(memDC = CreateCompatibleDC)
仔细看了MSDN关于CreateCompatibleBitmap的remark章节才清楚。原来memDC默认识单色的。新的bitmap必须使用hSrcDC来创建,才能出现彩色图。
The following is copied from MSDN
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. To create a color bitmap, use the hDC that was used to create the memory device context, as shown in the following code:
HDC memDC = CreateCompatibleDC ( hDC );
HBITMAP memBM = CreateCompatibleBitmap ( hDC, nWidth, nHeight );
SelectObject ( memDC, memBM );
最新评论
1 周 6 天之前
6 周 4 天之前
10 周 4 天之前