獲取鼠標點擊的RGB

	GetCursorPos(&point);
	HDC hDc;
	COLORREF ref;
	hDc=::GetDC(0);
	ref=::GetPixel(hDc,point.x,point.y);	
	BYTE R=  GetRValue( ref);
	BYTE G=GetGValue( ref);
	BYTE B=GetBValue( ref);
	CString p_color;
	p_color.Format(_T("R:%d,G:%d,B:%d"),(int)R,(int)G,(int)B);
	MessageBox(p_color);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章