怎么获取某点的像素值 得到一个DC句柄然后GetPixel不可以吗~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void CTestDlg::OnButton1() { // TODO: Add your control notification handler code here CPoint pt; HDC hDC = ::GetDC(NULL); pt.x=300; pt.y=400; COLORREF clr = ::GetPixel(hDC, pt.x, pt.y); CString RV,GV,BV; RV.Format("%d",GetRValue(clr)); GV.Format("%d",GetGValue(clr)); BV.Format("%d",GetBValue(clr)); ::ReleaseDC(NULL, hDC); MessageBox(RV+","+GV+","+BV);} HDC hDC = ::GetDC(NULL);int x = 300;int y = 400;COLORREF clr = ::GetPixel(hDC, x, y); GetPixel(::GetDC(NULL), 300, 400); HWND hwnd=::GetForegroundWindow();HDC hDC=::GetDC(hwnd);COLORREF mycolor=::GetPixel(hDC,point.x,point.y); COLORREF GetPixel( HDC hdc, // handle to DC int nXPos, // x-coordinate of pixel int nYPos // y-coordinate of pixel); nXPos:要取象素点的x坐标nYPos:要取象素点的y坐标返回值是COLORREF类型 GetPixel(::GetDC(NULL), 300, 400); 支持Prince_vegeta 的答案 通俗易懂! C++ 高手求助关于 windowsGDI 映射模式的问题 有做过越南版本的吗?请指教下 VC8,Socket的recv函数VISTA下遇到断网怎么不返回啊,XP都能返回 vc 怎么快速判断网络是否通畅 关于swprintf的一个问题 一个使用SQLConfigDataSource()遇见的问题 为什么用TextOut, 或DrawText输出字母线条总不是一象素粗? 有关VC中内嵌汇编指令asm的资料 自己构造IP和TCP包头的问题 找不到一些类文件 ActiveX控件导致浏览器死掉 如何建立像Messagebox的对话框
{
// TODO: Add your control notification handler code here
CPoint pt;
HDC hDC = ::GetDC(NULL);
pt.x=300;
pt.y=400;
COLORREF clr = ::GetPixel(hDC, pt.x, pt.y);
CString RV,GV,BV;
RV.Format("%d",GetRValue(clr));
GV.Format("%d",GetGValue(clr));
BV.Format("%d",GetBValue(clr));
::ReleaseDC(NULL, hDC);
MessageBox(RV+","+GV+","+BV);
}
int x = 300;
int y = 400;
COLORREF clr = ::GetPixel(hDC, x, y);
HDC hDC=::GetDC(hwnd);
COLORREF mycolor=::GetPixel(hDC,point.x,point.y);
HDC hdc, // handle to DC
int nXPos, // x-coordinate of pixel
int nYPos // y-coordinate of pixel
);
nXPos:要取象素点的x坐标
nYPos:要取象素点的y坐标返回值是COLORREF类型