FastReport VCL程序员手册:如何使用样式

首先,让我们记住什么是“样式”、“样式集”和“样式库”。

样式是一个元素,它拥有名称和属性,并决定了设计属性,即颜色、字体和框架。样式决定了 表对象的设计方式。诸如此类的对象TfrxMemoView具有Style属性,该属性旨在设置样式名称。将值应用于此属性时,样式设计属性将复制到对象。

一组样式由多个样式组成,它们引用一个 表。该TfrxReport组分具有Styles属性,该属性是指的对象TfrxStyles类型。这组样式也有一个名字。样式集决定了整个 表的设计。

样式库包括多组样式。在库的帮助下,可以方便地为 表设计选择一个具体的集合。

该TfrxStyleItem代表风格。

  TfrxStyleItem = class(TCollectionItem)  public    // Style name.    property Name: String;    // Background color.    property Color: TColor;    // Font.    property Font: TFont;    // Frame.    property Frame: TfrxFrame;  end;

样式集由TfrxStyles类表示。它包括执行读取、保存、添加、删除以及搜索样式等设置操作的方法。默认情况下,样式文件集具有 FS3 扩展名。

  TfrxStyles = class(TCollection)  public    // Creates the styles set. One can specify “nil” instead of “AReport,” however in this case a user would be unable to use the “Apply” method.    constructor Create(AReport: TfrxReport);    // Adds a new style.    function Add: TfrxStyleItem;    // Returns the style with the given name.    function Find(const Name: String): TfrxStyleItem;    // Applies a set to a report.    procedure Apply;    // Returns the list of the styles names.    procedure GetList(List: TStrings);    // Reads a set.    procedure LoadFromFile(const FileName: String);    procedure LoadFromStream(Stream: TStream);    // Saves a set.    procedure SaveToFile(const FileName: String);    procedure SaveToStream(Stream: TStream);    // The list of styles.    property Items[Index: Integer]: TfrxStyleItem; default;    // A set’s name.    property Name: String;  end;

总之,最后一个TfrxStyleSheet类代表一个样式库。它具有库读取/保存以及添加、删除和样式集搜索的方法。

 TfrxStyleSheet = class(TObject)  public   // Constructs a library.    constructor Create;   // Clears a library.    procedure Clear;   // Deletes a set with certain number.    procedure Delete(Index: Integer);   // Returns the list of the names of styles’ sets.    procedure GetList(List: TStrings);   // Loads a library.    procedure LoadFromFile(const FileName: String);    procedure LoadFromStream(Stream: TStream);   // Saves a library.    procedure SaveToFile(const FileName: String);    procedure SaveToStream(Stream: TStream);   // Adds a new set of styles to the library.    function Add: TfrxStyles;   // Returns a number of styles’ sets in the library.    function Count: Integer;   // Returns a set with the given name.    function Find(const Name: String): TfrxStyles;   // Returns a set number with the given name.    function IndexOf(const Name: String): Integer;   // The list of styles’ sets.    property Items[Index: Integer]: TfrxStyles; default;  end;

如果您对FastReport感兴趣,欢迎加入FastReport QQ交流群:702295239

还想要更多吗可以点击阅读【FastReport 表2021最新资源盘点】查找需要的教程资源。让人兴奋的是FastReport .NET正在 火热销售中!>>查看价格详情

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年5月8日
下一篇 2021年5月8日

相关推荐

发表回复

登录后才能评论