Einzelnen Beitrag anzeigen

TStringlist

Registriert seit: 1. Dez 2003
360 Beiträge
 
Turbo Delphi für Win32
 
#7

Re: Farbe unter dem Mauszeiger erkennen

  Alt 23. Jan 2005, 00:11
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;
MfG (& Thx ggf.)
  Mit Zitat antworten Zitat