- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
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.