现在的位置: 首页 > 综合 > 正文

Delphi XE2 之 FireMonkey 入门(7) – TText 与 TFont

2011年06月04日 ⁄ 综合 ⁄ 共 676字 ⁄ 字号 评论关闭
TText 也是从 TShape(TControl -> TShape)继承;

而与之类似的 TLabel 的继承序列是 TControl -> TStyledControl -> TTextControl -> TLabel.


TText 的主要成员:

{ 属性 }
Text          : string;     //文本内容
Font          : TFont;      //字体
Fill          : TBrush;     //文本画刷
HorzTextAlign : TTextAlign; //横向对齐
VertTextAlign : TTextAlign; //纵向对齐
AutoSize      : Boolean;    //改变控件大小以适合文本
Stretch       : Boolean;    //拉伸文本以适合控件
WordWrap      : Boolean;    //是否换行

{ 方法 }
Realign; //重新对齐

TFont(来自 FMX.Types) 的主要成员:

{ 属性 }
Family : TFontName;   //名称
Size   : Single;      //大小
Style  : TFontStyles; //样式

procedure TForm1.FormCreate(Sender: TObject);
begin
  Text1.Align := TAlignLayout.alClient;

  Text1.Text := ' Delphi XE2 ';

  Text1.Font.Family := '微软雅黑';
  Text1.Font.Size := 32;
  Text1.Font.Style := [TFontStyle.fsBold, TFontStyle.fsUnderline];

  Text1.Fill.Color := claRed;
  Text1.Stretch := True;
end;

抱歉!评论已关闭.