我在VIEW类的ON_KEYDOWN里设了以下语句:
     COLORREF clrGet;
CClientDC dc(this);
clrGet = dc.GetPixel(30, 50);
但是无论点(30,50)的颜色如何,clrGet的值都是一样,如何解决啊?????!!!

解决方案 »

  1.   

    看里你几个同样的帖子,看来问题不在这里,而是你怎么知道clrGet的值?用调试跟踪一下看看,或者,用MessageBox什么的输出来看看。
      

  2.   

    我测试了一下,确实是这样。在msdn中对函数GetPixel(30, 50);有下面的一段说明:
    Retrieves the RGB color value of the pixel at the point specified by x and y. The point must be in the clipping region. If the point is not in the clipping region, the function has no effect and returns –1. Not all devices support the GetPixel function. For more information, see the RC_BITBLT raster capability under the GetDeviceCaps member function.是不是因为“Not all devices support the GetPixel function”呢?