Delphi 全局画点TCanvas.Pixels[X,Y]

procedure TForm1.btnChangePixelClick(Sender: TObject);
var
    baseX : integer ;
    baseY : integer ;
    i,j : integer;
    c : TCanvas;
begin
    baseX :=100;
    baseY := 100;
    c := TCanvas.create;
    try
        c.Handle := GetDC(0);
        for i := baseX - 1 to baseX + 1 do
        begin
            for j := baseY - 1 to baseY + 1 do
            begin
                c.Pixels[i,j] := RGB($FF,0,0);
                //self.Canvas.Pixels[i,j] := RGB($FF,0,0);
            end;
        end;
    finally
      c.Free;
    end;

end;

end.

  

 

posted @ 2015-01-14 12:05  庚武  Views(1782)  Comments(0Edit  收藏  举报