第1个回答 推荐于2016-05-14
COLORREF clr = ::GetPixel(hDC, point.x, point.y); //获取当前鼠标点像素值
m_red = GetRValue(clr);
m_bluee = GetBValue(clr);
m_green = GetBValue(clr);
第2个回答 2009-07-19
//全局变量
int x,y;
int r ,g,b ;
COLORREF up;
char text[32];
case WM_LBUTTONDOWN:
x = LOWORD(lParam);
y = HIWORD(lParam);
up = GetPixel(GetDC(hWnd),x,y); //得到点的RGB颜色
r = GetRValue(up); //返回R的颜色值!
g = GetGValue(up); //返回G的颜色值!
b = GetBValue(up); //返回B的颜色值!
sprintf_s(text, "R:%d, G %d, B %d ", r,g,b);
OutputDebugString(text);
MessageBox(NULL,text , "坐标颜色值", MB_OK);
break;