1。如何获取屏幕某一点颜色?
   我用canvas.pixles[x,y]总是获得 -1
2。我用canvas在form上画的东西,怎样才能最小化或挡住窗口后不被抹去?

解决方案 »

  1.   

    1。
    procedure TForm1.Button1Click(Sender: TObject);
    var
      aCanvas: TCanvas;
      aColor: TColor;
    begin
      aCanvas := TCanvas.Create;
      aCanvas.Handle := GetDC(0);
      aColor := aCanvas.Pixels[1, 1];
      aCanvas.Free;
    end;2.
      在OnPaint事件中画
      

  2.   

    >>我用canvas.pixles[x,y]总是获得 -1
    你只能得到 canvas 範圍內的TColor, 幫助解釋得很清楚Read Pixels to learn the color on the drawing surface at a specific pixel position within the current clipping region. If the position is outside the clipping rectangle, reading the value of Pixels returns -1.>>2。我用canvas在form上画的东西,怎样才能最小化或挡住窗口后不被抹去?
    在Form的OnPaint事件中再畫一次