码迷,mamicode.com
首页 > Windows程序 > 详细

delphi xe10 获取屏幕截图

时间:2019-07-05 12:36:21      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:canvas   begin   creat   rtsp   finally   func   service   result   try   

//截取屏幕图片
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 获取屏幕截图

标签:canvas   begin   creat   rtsp   finally   func   service   result   try   

原文地址:https://www.cnblogs.com/guorongtao/p/11137457.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!