基本信息
源码名称:c++ 实时获取光标处颜色(类似抓色器)
源码大小:15.37M
文件格式:.rar
开发语言:C/C++
更新时间:2020-06-21
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 10 元 
   源码介绍
实时获取鼠标光标位置的颜色

CPoint point;
GetCursorPos(&point);//get cursor pos
HDC hDC = ::GetDC(NULL);//lock paint DC
COLORREF colorref = ::GetPixel(hDC, point.x, point.y);//get the cursor color
CString Color_textr, Color_textg, Color_textb, Color_textrgb;
red = GetRValue(colorref);//store red color
Color_textr.Format(_T("%d"), red);
green = GetGValue(colorref);//store green color
Color_textg.Format(_T("%d"), green);
blue = GetBValue(colorref);//store blue color
Color_textb.Format(_T("%d"), blue);
Color_textrgb = Color_textr _T(",") Color_textg _T(",") Color_textb;
SetDlgItemText(IDC_Color, Color_textrgb);//display the color value
//RGB Hex值显示
Color_textrgb.Format(_T("#%02X,%02X,%02X"), colorref & 0xFF, (colorref >> 8) & 0xFF, colorref >> 16);
strHVl.SetWindowText(Color_textrgb);
Color_textrgb.Format(_T("%d,%d"), point.x, point.y);
strLoc.SetWindowText(Color_textrgb);
OnPaint();
::ReleaseDC(NULL, hDC);//unlock DC
CDialogEx::OnTimer(nIDEvent);