两年前, 我做过一段时间的iOS开发, 我记得自己用过这样一个工具: 该工具可以实时显示鼠标所在位置的像素值。 下面, 我自己用BCB来做一个这样的工具, 代码如下(定时时间间隔为10ms):
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
HDC hDC = GetWindowDC(NULL);
TPoint Pos = Mouse->CursorPos;
COLORREF nColor = GetPixel(hDC, Pos.x, Pos.y);
ReleaseDC(NULL, hDC);
BYTE R = GetRValue(nColor);
BYTE G = GetG