"TfrxComponent"是所有FastReport组件的基类,这种类型的对象拥有“coordinates”, “size”, “font” ,“visibility” 以及一系列子对象。该类用过多种方法,允许保存和恢复对象状态。本文主要介绍FastReport VCL报表的的类层次结构中的"TfrxComponent"基类。
TfrxComponent = class(TComponent)
protected
procedure SetParent(AParent: TfrxComponent); virtual;
procedure SetLeft(Value: Extended); virtual;
procedure SetTop(Value: Extended); virtual;
procedure SetWidth(Value: Extended); virtual;
procedure SetHeight(Value: Extended); virtual;
procedure SetFont(Value: TFont); virtual;
procedure SetParentFont(Value: Boolean); virtual;
procedure SetVisible(Value: Boolean); virtual;
procedure FontChanged(Sender: TObject); virtual;
public
constructor Create(AOwner: TComponent); override;
procedure Assign(Source: TPersistent); override;
procedure Clear; virtual;
procedure CreateUniqueName;
procedure LoadFromStream(Stream: TStream); virtual;
procedure SaveToStream(Stream: TStream); virtual;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Extended);
function FindObject(const AName: String): TfrxComponent;
class function GetDescription: String; virtual;
property Objects: TList readonly;
property AllObjects: TList readonly;
property Parent: TfrxComponent;
property Page: TfrxPage readonly;
property Report: TfrxReport readonly;
property IsDesigning: Boolean;
property IsLoading: Boolean;
property IsPrinting: Boolean;
property BaseName: String;
property Left: Extended;
property Top: Extended;
property Width: Extended;
property Height: Extended;
property AbsLeft: Extended readonly;
property AbsTop: Extended readonly;
property Font: TFont;
property ParentFont: Boolean;
property Restrictions: TfrxRestrictions;
property Visible: Boolean;
end;
- Clear:清除对象内容,并删除它的所有子对象
- CreateUniqueName:创建对象的唯一名称
- LoadFromStream:加载对象以及流中的所有子对象
- SaveToStream:保存对象到流
- SetBounds:设定对象的坐标和大小
- FindObject:在子对象中搜索指定了名称的对象
- GetDescription:返回对象描述
当你修改相应的属性时候,会调用下列方法。如何你需要额外处理,你需要覆盖它们。
- SetParent
- SetLeft
- SetTop
- SetWidth
- SetHeight
- SetFont
- SetParentFont
- SetVisible
- FontChanged
在“TfrxComponent”类中定义了以下属性:
- Objects:list of child objects
- AllObjects:list of all subordinate objects
- Parent: link to parent object
- Page:link to report page on which object resides
- Report link:to report in which object appears
- IsDesigning: “True” if designer is running
- IsLoading :“True” if object is being loaded from stream
- IsPrinting :“True” if object is being printed out
- BaseName: object base name; this value is used in “CreateUniqueName” method
- Left object: X-coordinate (relative to parent)
- Top :object Y-coordinate (relative to parent)
- Width: object width
- Height :object height
- AbsLeft :object absolute X-coordinate
- AbsTop :object absolute Y-coordinate
- Font :object font
- ParentFont: if “True” then uses parent object font settings
- Restrictionsset of flags which restricts one or more object operations
- Visible :object visibility