【发布时间】:2011-12-18 14:43:51
【问题描述】:
我正在尝试找到一种方法来全局更改 FireMonkey 项目中的字体。 无需更改所有组件的字体属性的最简单方法是什么? 如果有办法设置整个应用程序或整个表单的字体(如在 VCL 中)?
【问题讨论】:
-
你试过什么?似乎新的 XE2“实时绑定”系统可能对做这样的事情有用。
标签: delphi delphi-xe2 firemonkey
我正在尝试找到一种方法来全局更改 FireMonkey 项目中的字体。 无需更改所有组件的字体属性的最简单方法是什么? 如果有办法设置整个应用程序或整个表单的字体(如在 VCL 中)?
【问题讨论】:
标签: delphi delphi-xe2 firemonkey
你应该可以用 Duck Duck Delphi 做到这一点......
这将更改表单上组件的所有字体:
Form1.duck.all.on('Font').setTo('Name','Arial').setTo('Color',TAlphaColors.Red);
我还没有尝试过,但是这些“应该”中的任何一个都可以在整个应用程序范围内执行相同的操作:
Application.duck.all.each.on('Font').setTo('Name','Arial').setTo('Color',TAlphaColors.Red);
Screen.duck.all.each.on('Font').setTo('Name','Arial').setTo('Color',TAlphaColors.Red);
Duck Duck Delphi 可以在这里找到:
【讨论】:
Just to set a new TFont.FontService , you can change default font size and
family
unit ChangeDefaultFont;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,FMX.graphics;
type
TDefaultFont = class (TInterfacedObject, IFMXSystemFontService)
public
function GetDefaultFontFamilyName: string;
function GetDefaultFontSize: Single;
end;
implementation
{ TDefaultFont }
function TDefaultFont.GetDefaultFontFamilyName: string;
begin
Result := 'Tahoma';
end;
function TDefaultFont.GetDefaultFontSize: Single;
begin
Result := 26.0;
end;
initialization
TFont.FontService := TDefaultFont.Create;
end.
【讨论】: