setpixel有关问题 win32 api
setpixel问题 win32 apihdcMem2 CreateCompatibleDC(hdc)hbmp2 CreateCompatibleBitmap(hdc,bmp.bmWi
setpixel问题 win32 api
hdcMem2 = CreateCompatibleDC(hdc);
hbmp2 = CreateCompatibleBitmap(hdc,bmp.bmWidth,bmp.bmHeight);
SelectObject(hdcMem2 , hbmp2);
for (int i=0;i<bmp.bmWidth;++i)
{
for (int j=0;j<bmp.bmHeight;++j){
tempCol = SetPixel(hdc,i,j,0xFFF00FFF);//这儿返回值为黑色,在屏幕上显示也是黑色,咋怎?
}
}
[解决办法] tempCol = SetPixel(hdc,i,j,0x00F00FFF);
COLORREF
The COLORREF value is a 32-bit value used to specify an RGB color.
Remarks
When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form:
0x00bbggrr
The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in windef.h.
See Also
Colors Overview, Color Structures