api画图,纠结了一天
HDC compatibleDC = CreateCompatibleDC(NULL);
int width = 200, height = 200;
HBITMAP bitmap = CreateCompatibleBitmap(compatibleDC, width, height);
SelectObject(compatibleDC, bitmap);
//SetBkColor(compatibleDC, RGB(0x00, 0x00, 0xff));
//SetTextColor(compatibleDC, RGB(0xff, 0x00, 0x00));
for (int i = 0; i < 150; ++i)
SetPixel(compatibleDC, i, i, RGB(0x00, 0xff, 0x00));
DeleteObject(bitmap);
DeleteDC(compatibleDC);
以上代码是在想在画布上显示一条线,但是保存下来的图片却是一片黑色,
请问各位大哥大姐,牛人生手,小弟该段代码有什么问题?为什么保存下来的图片是黑色,而看不到一条线?