江南才子 发表于 2021-7-31 10:55:04

Delphi直接实现分享图片功能

procedure TCustomCameraViewDoc.ShareTextClick(Sender: TObject);
var
    FSharingService: IFMXShareSheetActionsService;
begin
inherited;
//分享照片

TPlatformServices.Current.SupportsPlatformService(IFMXShareSheetActionsService, FSharingService);
if FSharingService<>nil then
begin
   FSharingService.Share(nil, '', ImageViewer1.Bitmap);
end;

end;
先上代码,Delphi 支持跨平台开发app,早就实现了标准的Action,用于拍照、分享等功能实现,如果不用这标准的Action,那怎么办呢?
按上面的代码即可,直接取得IFMXShareSheetActionsService实例,并调用Share方法。
需要引用两个单元:FMX.Platform, FMX.MediaLibrary;


文档来源:51CTO技术博客https://blog.51cto.com/u_15317185/3224742
页: [1]
查看完整版本: Delphi直接实现分享图片功能