|
|
SelectedPixelFormat = ChoosePixelFormat(hDC, &pfd);
if(SelectedPixelFormat == 0)
{
MessageBox(WindowFromDC(hDC), "选择像素格式失败!", "错误", MB_ICONERROR|MB_OK);
exit(1);
}
retVal = SetPixelFormat(hDC, SelectedPixelFormat, &pfd);
................
DescribePixelFormat(hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
// 是否需要一个调色板
if(pfd.dwFlags & PFD_NEED_PALETTE || pfd.iPixelType == PFD_TYPE_COLORINDEX)
{
paletteSize = (1 << pfd.cColorBits);
//if(paletteSize > 4096)
paletteSize = 4096;
}
else
return;
|
|