想通过GetPixel函数得到对话框上某点的RGB值,它的参数x,y和point 该怎样设置?
假设我用下面语句显示一幅图dc.BitBlt(10,10,256,256,&dcMem,0,0,SRCCOPY);
现在想将(20,20)点的GetPixel返回值赋给变量m_ishang,请给出语句。

解决方案 »

  1.   

    COLORREF GetPixel( int x, int y ) const;COLORREF GetPixel( POINT point ) const;Return ValueFor either version of the function, an RGB color value for the color of the given point. It is –1 if the coordinates do not specify a point in the clipping region.ParametersxSpecifies the logical x-coordinate of the point to be examined.ySpecifies the logical y-coordinate of the point to be examined.pointSpecifies the logical x- and y-coordinates of the point to be examined.ResRetrieves 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.The GetPixel member function has two forms. The first takes two coordinate values; the second takes either a POINT structure or a CPoint object.
      

  2.   

    m_ishang是什么类型的变量啊?如果是COLORREF则可以这样写
    m_ishang=GetPixel(20,20);