Delphi Fmx 把内容复制到粘贴板上支持跨平台


本文整理自网络,侵删。

 
unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Edit,
  FMX.Controls.Presentation, FMX.StdCtrls;
type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.fmx}

uses
  FMX.Platform, System.Rtti;

procedure TForm1.Button1Click(Sender: TObject);
var
  C: FMX.Platform.IFMXClipboardService;
  V: System.Rtti.TValue;
begin
  if TPlatformServices.Current.SupportsPlatformService(IFMXClipboardService, IInterface(C)) then begin
    V := TValue.From(Edit1.Text);
    C.SetClipboard(V);
    Showmessage(Edit1.Text+'  已复制');
  end;
end;

end.

相关阅读 >>

Delphi 将字型样式转成字串

Delphi tms web core messagedlg对话框 yes no

Delphi waitforsingleobject 响应窗体

Delphi 利用http的post方法做个在线翻译的小工

Delphi twebbrowser控件禁用鼠标右键

Delphi链接自己的主页和邮件

Delphi获取操作系统安装磁盘盘符

Delphi isipadress 非正则表达式验证ip的方法

Delphi 类型映射及类型转换

Delphi 10.4 freeandnil 问题

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...