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 richedit选中文字右键菜单的实现

Delphi10.3读取json数据

Delphi webbrowser 加载html 将html代码转换成网页

Delphi操作excel说明

Delphi定时器相关的简单例子

Delphi实现的sunday字符串搜索算法

Delphi android下拉刷新

Delphi 中窗体form显示在第二个显示器中的方法

Delphi 获取内核地址的简单方法

Delphi根据url获取缓存文件的方法

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



打赏

取消

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

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

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

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

评论

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