频道分类

DELPHI XE 10.2.1 FMX平台 在图片上写字方法

作者:admin 来源: 日期:2019/10/29 14:16:46 人气: 标签:

 
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.Objects,
  FMX.Controls.Presentation, FMX.StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.fmx}
 
procedure TForm1.Button1Click(Sender: TObject);
var
   Rect: TRectF;
begin
   Rect.Create(0, 0, 500, 300);
   Image1.Bitmap.Canvas.BeginScene;
   Image1.Bitmap.Canvas.Font.Family:='宋体';
   Image1.Bitmap.Canvas.Font.Size:=80;
   Image1.Bitmap.Canvas.Fill.Color:=TAlphaColors.Red;
   Image1.Bitmap.Canvas.FillText(Rect, '我是LQEN', False, 1, [], TTextAlign.Center, TTextAlign.Center );
   Image1.Bitmap.Canvas.EndScene;
end;
 
 
end.

————————————————

原文链接:https://blog.csdn.net/lqena/article/details/78732313