void CFetchColorDlg::OnMouseMove(UINT nFlags, CPoint point) 
{
CDialog::OnMouseMove(nFlags, point);
// ChildWindowFromPoint(point)确定属于某一父窗口的哪一个子窗口(如果存在的话)包含一个
// 指定的点.搜索局限于父窗口的直接子窗口,子窗口的子窗口及更深层次的子窗口不会纳入搜索范围。
// 返回值为包含指定点的子窗口的句柄
CWnd* temp = ChildWindowFromPoint(point);
if (temp)
{
CDC* m_dc = temp->GetDC();
COLORREF m_color;
// MapWindowPoints该函数把相对于一个窗 口的坐标空
//间的一组点映射成相对于另一窗口的坐标空的一组点。
this->MapWindowPoints(temp,&point,1);

//获取颜色值
m_color = m_dc->GetPixel(point);

int r,g,b;
r = GetRValue(m_color);
g = GetGValue(m_color);
b = GetBValue(m_color);
CString str;

str.Format("%i",r);
m_red.SetWindowText(str); str.Format("%i",g);
m_green.SetWindowText(str); str.Format("%i",b);
m_blue.SetWindowText(str);

CRect m_rect;
m_test.GetClientRect(m_rect);
CDC* dc = m_test.GetDC();
CBrush m_brush(RGB(r,g,b));
dc->FillRect(m_rect,&m_brush);
}
}