如何更改标签的字体在delphi xe5 Firemonkey [英] How to change the font of a label in delphi xe5 Firemonkey

查看:748
本文介绍了如何更改标签的字体在delphi xe5 Firemonkey的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有打算prepare一种,有一对夫妇标签和下拉菜单的过程。但我不能改变标签的字体颜色。任何人都可以请帮助?

i have a procedure intended to prepare a form with a couple of labels and dropdowns. But i cannot change the font color of the label. Can anybody please assist?

我找到了一个链接,说他们找到了答案,但我无法理解它。 <一href="http://stackoverflow.com/questions/13884089/how-to-programmatically-alter-font-properties-in-firemonkey-controls">How以编程方式改变字体的属性在Firemonkey控制

I have found a link that says they found the answer, but i cannot make sense of it. How to programmatically alter Font properties in Firemonkey controls

下面是code为单位试图执行的变化。

Below is the code for the unit trying to execute the change.

unit procedures;

interface

Uses
  System.SysUtils, System.Types, System.UITypes, System.Classes,
  System.Variants, fmx.controls;

Procedure resetproductlists;

implementation

uses main_unit, datalive_unit, AddUniqueItemToComboBox;

Procedure resetproductlists;
begin
  With Datalive.products Do
  Begin
    Try
      active := False;
      params.clear;
      sql.text := 'select supplier,item,width,height from products';
      active := True;
      Main.Combobox1.clear;
      Main.Combobox2.clear;
      Main.Combobox3.clear;
      Main.Combobox4.clear;
      Main.Edit1.text := '';
      Main.Edit2.text := '';
      Main.SpinBox1.Value := 0;
      Main.label13.text := 'n/a';
      Main.label13.StyledSettings := Main.label13.StyledSettings -
        [TStyledSetting.ssFontColor];
      Main.label13.FontColor := TAlphaColors.Aqua;
      Main.label14.text := 'R 0.00';
      Main.label14.FontColor := clBlack;
      while not eof do
      Begin
        try
          addtocombo(Main.Combobox1, Fieldbyname('supplier').Asstring);
          addtocombo(Main.Combobox2, Fieldbyname('item').Asstring);
          addtocombo(Main.Combobox3, Fieldbyname('width').Asstring);
          addtocombo(Main.Combobox4, Fieldbyname('height').Asstring);
        finally
          next;
        end;
      End;
    Finally
      active := False;
    End;
  End;
end;

end.

addtocombo 过程仅插入文本到组合框(如果它是不是已经在里面找到。)。

the addtocombo procedure only inserts the text into the combobox (if it is not already found in it.).

任何帮助将是巨大的。谢谢

Any assistance would be great. Thank you

推荐答案

泰华以下两行更改标签的字体颜色XE5:

Thw following two lines change the font color of a label in XE5:

  Label13.StyledSettings := Label13.StyledSettings - [TStyledSetting.FontColor];
  Label13.TextSettings.FontColor := TAlphaColors.Aqua;

但是,你已经有code在那里。所以,问题是,为什么它不能在你的情况下工作。我想说,无论你的code不执行或有新的变化颜色返黑。尝试设置在TTextSettings.SetFontColor条件断点 FFontColor:=值; ,只有改变颜色,或从水上时,火灾。这可能给你一个线索。

But you already have that code in there. So the question is why it does not work in your case. I'd say that either your code does not execute or something changes the color back to black. Try setting a conditional breakpoint in TTextSettings.SetFontColor at FFontColor := Value; that only fires when changing the color to or from Aqua. This might give you a clue.

这篇关于如何更改标签的字体在delphi xe5 Firemonkey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆