共用方式為


檢查裝置內容目前的像素格式

使用 GetPixelFormatDescribePixelFormat 函式來檢查裝置內容的目前像素格式,如下列程式碼片段所示。

PIXELFORMATDESCRIPTOR  pfd;
HDC    hdc;
int    iPixelFormat;
 
// if the device context has a current pixel format ...  
if (iPixelFormat = GetPixelFormat(hdc)) { 
 
    // obtain a detailed description of that pixel format  
    DescribePixelFormat(hdc, iPixelFormat, 
                             sizeof(PIXELFORMATDESCRIPTOR), &pfd); 
    }