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无关