delphi xe10 获取屏幕截图

Posted guorongtao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了delphi xe10 获取屏幕截图相关的知识,希望对你有一定的参考价值。

//截取屏幕图片
function MakeScaleScreenshot(Sender: TControl): TBitmap;
  function GetScreenScale: Single;
  var
    ScreenService: IFMXScreenService;
  begin
    Result := 1;
    if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService,  IInterface(ScreenService)) then
    begin
      Result := ScreenService.GetScreenScale;
    end;
  end;
var
  fScreenScale: Single;
begin 
  fScreenScale := GetScreenScale;
  Result := TBitmap.Create(Round(Sender.Width * fScreenScale),
    Round(Sender.Height * fScreenScale));
  Result.Clear(0);
  if Result.Canvas.BeginScene then
    try
      Sender.PaintTo(Result.Canvas, RectF(0, 0, Result.Width, Result.Height));
    finally
      Result.Canvas.EndScene;
    end;
end;

 

以上是关于delphi xe10 获取屏幕截图的主要内容,如果未能解决你的问题,请参考以下文章

Delphi 截图的问题,有代码,请高手帮帮

delphi截图问题

如何从 chrome 开发工具性能框架中获取屏幕截图

如何查看“屏幕截图:可通过屏幕获取”?

android 怎么获取当前屏幕的截图

Unity抓取相机截图/抓取屏幕截图