Hier nochmal eine nette kurze Lösung mittels GetPixel:
Delphi-Quellcode:
procedure TForm1.Timer1Timer(Sender: TObject);
var DC : HDC;
AColor : DWord;
begin
DC:=CreateDC('
DISPLAY',
NIL,
NIL,
NIL);
AColor := GetPixel(
DC,Mouse.CursorPos.X,Mouse.CursorPos.Y);
DeleteDC(
DC);
Label1.Caption := '
R: ' + IntToStr(AColor
and $FF) + '
; ' +
'
G: ' + IntToStr(AColor
and $FF00
div $100) + '
; ' +
'
B: ' + IntToStr(AColor
and $FF0000
div $10000);
end;