美文网首页
11.21 在图片中写字

11.21 在图片中写字

作者: 笑而不语_ddbd | 来源:发表于2017-11-21 12:04 被阅读0次

procedure TForm1.Button1Click(Sender: TObject);

var

Rect: TRectF;

A_PointF:Tpointf;

begin

//Rect.Create(0, 0, Image1.Width,Image1.Height);

//Rect.Create(0, 0, 100,100);

//  A_PointF :=  Tpointf.Create(0,0);

//  Rect.Create(A_PointF , Image1.height,Image1.width);

Rect.Create(0, 0, 381,300);

Image1.Bitmap.Canvas.BeginScene;

Image1.Bitmap.Canvas.Font.Family:='宋体';

Image1.Bitmap.Canvas.Font.Size:=20;

Image1.Bitmap.Canvas.Fill.Color:=TAlphaColors.Red;

Image1.Bitmap.Canvas.FillText(Rect, '我是刘庆'+#13+'爽肤水jhvjvfhjfhjfhjjjjfhjhjhjfhfhfhfhasdadassdgsdgssdgsdgsdgsdgsdgsdgsdgsdgsdgsdgsdgsdgsdgsddsgsdgdsgsd', TRUE, 1, [],  TTextAlign.Leading, TTextAlign.Leading );

Image1.Bitmap.Canvas.EndScene;

Image1.Bitmap.Size;

end;

注意Rect的大小要与Image的MultiResBitmap的custom的width与height一致

使用前一定要先在image中放一个图片

字体位置与image的width何height无关

相关文章

网友评论

      本文标题:11.21 在图片中写字

      本文链接:https://www.haomeiwen.com/subject/aynivxtx.html