hdc := GetDc( 0 );
Canvas := TCanvas.Create;
Canvas.Handle := hdc;
Canvas.CopyRect( Rect(0,0,Bmp.Width, Bmp.Height), Bmp.Canvas,Rect(0,0,Screen.Width, Screen.Height ));颜色 Bmp.Pixcels[x,y] 

解决方案 »

  1.   

    procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    var
     a:dword;
     r,g,b:BYTE;
     pos:tpoint;
    begin
       getcursorpos(pos);
       a:= GetPixel(GetDc(WindowFromPoint(pos)),pos.x,pos.y);
    //注意!这里的pos是相对整个屏幕的坐标!!注意换算成相对该窗体的坐标!
       r:= GetRValue(a);
       g:= GetGValue(a);
       b:= GetBValue(a);
       caption:= inttostr(r)+':'+inttostr(g)+':'+inttostr(b)+':'
       +inttostr(pos.x)+':'+inttostr(pos.y);
    end;