不确定我是否遗漏了一些东西,但你能在Firemonkey TCanvas中设置字体颜色吗?
我在以下属性中看不到任何暗示:
Canvas.Font. ????
任何帮助都会很棒
谢谢,
答案 0 :(得分:3)
测试此代码。 将图像放在表格和按钮上。
procedure TForm1.Button1Click(Sender: TObject);
var
b:TBitmap;
f:TFont;
begin
b:=TBitmap.Create;
f:=TFont.Create;
try
f.Family:='Arial';
f.Size:=20;
f.Style:=[TFontStyle.fsBold];
b.Width:=200;
b.Height:=200;
b.Canvas.BeginScene;
b.Canvas.Fill.Color:=TAlphaColorRec.red;
b.Canvas.Font.Assign(f);
b.Canvas.FillText(TRectF.Create(0,0,100,100),'AAA',False,1,[TFillTextFlag.RightToLeft], TTextAlign.Leading,TTextAlign.Center);
b.Canvas.EndScene;
image1.Bitmap:=b;
finally
b.Free;
f.Free;
end;
end;