Capture Layar - Lazarus

By Administrator 21 Jul 2020, 13:04:56 WIB Tutorial
Capture Layar - Lazarus

Keterangan Gambar : Lazarus Free Pascal


procedure TForm1.Capture(Sender: TObject);
var
 
MyPNG: TPortableNetworkGraphic;
  FileName: string;
  nfile: string;
  R: TRect;
begin
  nfile := extractfilepath(application.ExeName);
  MyPNG := TPortableNetworkGraphic.Create;
  try
    R := Rect(0, 0, grid.Width, grid.Height);
    MyPNG.SetSize(grid.Width, grid.Height);
    MyPNG.Canvas.CopyRect(R, grid.Canvas, R);

    // Get the name of the file to be created from the user
    FileName := 'Screenshot_' + FormatDateTime('dddd-mm-dd-yyyy-hhnnss', Now());
    MyPNG.SaveToFile(Format(nfile + '%s.png', [FileName]));
  finally
    MyPNG.Free;
  end;
end;       




Write a Facebook Comment

Komentar dari Facebook

Write a comment

Ada 33 Komentar untuk Berita Ini

View all comments

Write a comment