var
CursorPos : TPoint ;
DeviceContext: HDC ;
CapturedColor: Cardinal ;
begin
CapturedColor := 0 ;
DeviceContext := GetDC(0) ;
if DeviceContext > 0 then
begin
try
if GetCursorPos(CursorPos) then
CapturedColor := GetPixel(DeviceContext, CursorPos.x, CursorPos.y) ;
finally
DeleteDC(DeviceContext) ;
end ;
end ;
//if CapturedColor <> -1 then
//begin
// self.Canvas.Brush.Color := CapturedColor ;
// self.Canvas.FillRect(self.GetClientRect())
//end
end ;
|