【发布时间】:2021-01-15 19:02:47
【问题描述】:
我的表单上有 5 个标签,它们的字体样式都应该添加 BOLD 属性。我尝试使用下面的代码执行此操作,但只有 Label2 变为粗体,其余部分仍保持在设计时的状态。
Sleep(350);
TThread.Synchronize(nil,
procedure
begin
Label2.TextSettings.Font.Style := Label2.TextSettings.Font.Style +
[TFontStyle.fsBold];
Label2.TextSettings.FontColor := TAlphaColorRec.Gray;
end);
Sleep(350);
TThread.Synchronize(nil,
procedure
begin
Label3.TextSettings.Font.Style := Label3.TextSettings.Font.Style +
[TFontStyle.fsBold];
Label3.TextSettings.FontColor := TAlphaColorRec.Gray;
end);
Sleep(350);
TThread.Synchronize(nil,
procedure
begin
Label4.TextSettings.Font.Style := Label4.TextSettings.Font.Style +
[TFontStyle.fsBold];
Label4.TextSettings.FontColor := TAlphaColorRec.Gray;
end);
Sleep(350);
TThread.Synchronize(nil,
procedure
begin
Label5.TextSettings.Font.Style := Label5.TextSettings.Font.Style +
[TFontStyle.fsBold];
Label5.TextSettings.FontColor := TAlphaColorRec.Gray;
end);
Sleep(350);
TThread.Synchronize(nil,
procedure
begin
Label6.TextSettings.Font.Style := Label6.TextSettings.Font.Style +
[TFontStyle.fsBold];
Label6.TextSettings.FontColor := TAlphaColorRec.Gray;
end);
Sleep(350);
每个标签上的颜色都会发生变化,但字体并没有变得粗体,除了我尝试加粗的第一个标签......这让我感到困惑。请帮我。 我使用 Delphi 10.3.3 社区版和 Android 10 智能手机(Lineage 17.1)
【问题讨论】:
-
你是在外线程还是主线程中运行上面的代码?
-
在一个外部线程中,这就是我同步它的原因
-
好,我只是想检查一下!
标签: android delphi fonts label delphi-10.3-rio