📄 frxclass.pas
字号:
FRecNo: Integer;
function GetDisplayText(Index: String): WideString; virtual;
function GetDisplayWidth(Index: String): Integer; virtual;
function GetFieldType(Index: String): TfrxFieldType; virtual;
function GetValue(Index: String): Variant; virtual;
procedure SetName(const NewName: TComponentName); override;
procedure SetUserName(const Value: String); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
{ Navigation methods }
procedure Initialize; virtual;
procedure Finalize; virtual;
procedure Open; virtual;
procedure Close; virtual;
procedure First; virtual;
procedure Next; virtual;
procedure Prior; virtual;
function Eof: Boolean; virtual;
{ Data access }
function FieldsCount: Integer; virtual;
function HasField(const fName: String): Boolean;
function IsBlobField(const fName: String): Boolean; virtual;
function RecordCount: Integer; virtual;
procedure AssignBlobTo(const fName: String; Obj: TObject); virtual;
procedure GetFieldList(List: TStrings); virtual;
property DisplayText[Index: String]: WideString read GetDisplayText;
property DisplayWidth[Index: String]: Integer read GetDisplayWidth;
property FieldType[Index: String]: TfrxFieldType read GetFieldType;
property Value[Index: String]: Variant read GetValue;
property CloseDataSource: Boolean read FCloseDataSource write FCloseDataSource;
{ OpenDataSource is kept for backward compatibility only }
property OpenDataSource: Boolean read FOpenDataSource write FOpenDataSource default True;
property RecNo: Integer read FRecNo;
property ReportRef: TfrxReport read FReportRef write FReportRef;
property OnClose: TNotifyEvent read FOnClose write FOnClose;
property OnOpen: TNotifyEvent read FOnOpen write FOnOpen;
published
property Enabled: Boolean read FEnabled write FEnabled default True;
property RangeBegin: TfrxRangeBegin read FRangeBegin write FRangeBegin default rbFirst;
property RangeEnd: TfrxRangeEnd read FRangeEnd write FRangeEnd default reLast;
property RangeEndCount: Integer read FRangeEndCount write FRangeEndCount default 0;
property UserName: String read FUserName write SetUserName;
property OnCheckEOF: TfrxCheckEOFEvent read FOnCheckEOF write FOnCheckEOF;
property OnFirst: TNotifyEvent read FOnFirst write FOnFirst;
property OnNext: TNotifyEvent read FOnNext write FOnNext;
property OnPrior: TNotifyEvent read FOnPrior write FOnPrior;
end;
TfrxUserDataSet = class(TfrxDataset)
private
FFields: TStrings;
FOnGetValue: TfrxGetValueEvent;
procedure SetFields(const Value: TStrings);
protected
function GetDisplayText(Index: String): WideString; override;
function GetValue(Index: String): Variant; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function FieldsCount: Integer; override;
procedure GetFieldList(List: TStrings); override;
published
property Fields: TStrings read FFields write SetFields;
property OnGetValue: TfrxGetValueEvent read FOnGetValue write FOnGetValue;
end;
TfrxCustomDBDataSet = class(TfrxDataSet)
private
FAliases: TStrings;
FFields: TStringList;
procedure SetFieldAliases(const Value: TStrings);
protected
property Fields: TStringList read FFields;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function ConvertAlias(const fName: String): String;
function GetAlias(const fName: String): String;
function FieldsCount: Integer; override;
published
property CloseDataSource;
property FieldAliases: TStrings read FAliases write SetFieldAliases;
property OpenDataSource;
property OnClose;
property OnOpen;
end;
TfrxDBComponents = class(TComponent)
public
function GetDescription: String; virtual;
end;
TfrxCustomDatabase = class(TfrxDialogComponent)
protected
procedure BeforeConnect(var Value: Boolean);
procedure SetConnected(Value: Boolean); virtual;
procedure SetDatabaseName(const Value: String); virtual;
procedure SetLoginPrompt(Value: Boolean); virtual;
procedure SetParams(Value: TStrings); virtual;
function GetConnected: Boolean; virtual;
function GetDatabaseName: String; virtual;
function GetLoginPrompt: Boolean; virtual;
function GetParams: TStrings; virtual;
public
procedure SetLogin(const Login, Password: String); virtual;
property Connected: Boolean read GetConnected write SetConnected default False;
property DatabaseName: String read GetDatabaseName write SetDatabaseName;
property LoginPrompt: Boolean read GetLoginPrompt write SetLoginPrompt default True;
property Params: TStrings read GetParams write SetParams;
end;
TfrxComponentClass = class of TfrxComponent;
{ Report Objects }
TfrxFrame = class(TPersistent)
private
private
FColor: TColor;
FDropShadow: Boolean;
FShadowWidth: Extended;
FShadowColor: TColor;
FStyle: TfrxFrameStyle;
FTyp: TfrxFrameTypes;
FWidth: Extended;
function IsShadowWidthStored: Boolean;
function IsTypStored: Boolean;
function IsWidthStored: Boolean;
public
constructor Create;
procedure Assign(Source: TPersistent); override;
function Diff(AFrame: TfrxFrame): String;
published
property Color: TColor read FColor write FColor default clBlack;
property DropShadow: Boolean read FDropShadow write FDropShadow default False;
property ShadowColor: TColor read FShadowColor write FShadowColor default clBlack;
property ShadowWidth: Extended read FShadowWidth write FShadowWidth stored IsShadowWidthStored;
property Style: TfrxFrameStyle read FStyle write FStyle default fsSolid;
property Typ: TfrxFrameTypes read FTyp write FTyp stored IsTypStored;
property Width: Extended read FWidth write FWidth stored IsWidthStored;
end;
TfrxView = class(TfrxReportComponent)
private
FAlign: TfrxAlign;
FBrushStyle: TBrushStyle;
FColor: TColor;
FCursor: TCursor;
FDataField: String;
FDataSet: TfrxDataSet;
FDataSetName: String;
FFrame: TfrxFrame;
FPrintable: Boolean;
FShiftMode: TfrxShiftMode;
FTagStr: String;
FTempTag: String;
FTempURL: String;
FURL: String;
FPlainText: Boolean;
procedure SetFrame(const Value: TfrxFrame);
procedure SetDataSet(const Value: TfrxDataSet);
procedure SetDataSetName(const Value: String);
function GetDataSetName: String;
protected
FX: Integer;
FY: Integer;
FX1: Integer;
FY1: Integer;
FDX: Integer;
FDY: Integer;
FFrameWidth: Integer;
FScaleX: Extended;
FScaleY: Extended;
FOffsetX: Extended;
FOffsetY: Extended;
FCanvas: TCanvas;
procedure BeginDraw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); virtual;
procedure DrawBackground; virtual;
procedure DrawFrame; virtual;
procedure DrawLine(x, y, x1, y1, w: Integer);
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function Diff(AComponent: TfrxComponent): String; override;
function IsDataField: Boolean;
procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
procedure BeforePrint; override;
procedure GetData; override;
procedure AfterPrint; override;
property BrushStyle: TBrushStyle read FBrushStyle write FBrushStyle default bsSolid;
property Color: TColor read FColor write FColor default clNone;
property DataField: String read FDataField write FDataField;
property DataSet: TfrxDataSet read FDataSet write SetDataSet;
property DataSetName: String read GetDataSetName write SetDataSetName;
property Frame: TfrxFrame read FFrame write SetFrame;
property PlainText: Boolean read FPlainText write FPlainText;
property Cursor: TCursor read FCursor write FCursor default crDefault;
property TagStr: String read FTagStr write FTagStr;
property URL: String read FURL write FURL;
published
property Align: TfrxAlign read FAlign write FAlign default baNone;
property Printable: Boolean read FPrintable write FPrintable default True;
property ShiftMode: TfrxShiftMode read FShiftMode write FShiftMode default smAlways;
property Left;
property Top;
property Width;
property Height;
property GroupIndex;
property Restrictions;
property Visible;
property OnAfterData;
property OnAfterPrint;
property OnBeforePrint;
property OnPreviewClick;
end;
TfrxStretcheable = class(TfrxView)
private
FStretchMode: TfrxStretchMode;
public
FSaveHeight: Extended;
constructor Create(AOwner: TComponent); override;
function CalcHeight: Extended; virtual;
function DrawPart: Extended; virtual;
procedure InitPart; virtual;
published
property StretchMode: TfrxStretchMode read FStretchMode write FStretchMode
default smDontStretch;
end;
TfrxHighlight = class(TPersistent)
private
FActive: Boolean;
FColor: TColor;
FCondition: String;
FFont: TFont;
procedure SetFont(const Value: TFont);
public
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
published
property Active: Boolean read FActive write FActive default False;
property Font: TFont read FFont write SetFont;
property Color: TColor read FColor write FColor default clNone;
property Condition: String read FCondition write FCondition;
end;
TfrxFormat = class(TPersistent)
private
FDecimalSeparator: String;
FFormatStr: String;
FKind: TfrxFormatKind;
public
procedure Assign(Source: TPersistent); override;
published
property DecimalSeparator: String read FDecimalSeparator write FDecimalSeparator;
property FormatStr: String read FFormatStr write FFormatStr;
property Kind: TfrxFormatKind read FKind write FKind default fkText;
end;
TfrxCustomMemoView = class(TfrxStretcheable)
private
FAllowExpressions: Boolean;
FAllowHTMLTags: Boolean;
FAutoWidth: Boolean;
FCharSpacing: Extended;
FClipped: Boolean;
FDisplayFormat: TfrxFormat;
FExpressionDelimiters: String;
FFlowTo: TfrxCustomMemoView;
FGapX: Extended;
FGapY: Extended;
FHAlign: TfrxHAlign;
FHideZeros: Boolean;
FHighlight: TfrxHighlight;
FLineSpacing: Extended;
FMemo: TWideStrings;
FParagraphGap: Extended;
FPartMemo: WideString;
FRotation: Integer;
FRTLReading: Boolean;
FStyle: String;
FSuppressRepeated: Boolean;
FTempMemo: WideString;
FUnderlines: Boolean;
FVAlign: TfrxVAlign;
FValue: Variant;
FWordBreak: Boolean;
FWordWrap: Boolean;
procedure SetMemo(const Value: TWideStrings);
procedure SetRotation(Value: Integer);
procedure SetText(const Value: WideString);
function AdjustCalcHeight: Extended;
function AdjustCalcWidth: Extended;
function GetText: WideString;
function IsExprDelimitersStored: Boolean;
function IsLineSpacingStored: Boolean;
function IsGapXStored: Boolean;
function IsGapYStored: Boolean;
function IsHighlightStored: Boolean;
function IsParagraphGapStored: Boolean;
procedure SetHighlight(const Value: TfrxHighlight);
procedure SetDisplayFormat(const Value: TfrxFormat);
procedure SetStyle(const Value: String);
function IsCharSpacingStored: Boolean;
protected
FLastValue: Variant;
FTotalPages: Integer;
FTextRect: TRect;
function CalcAndFormat(const Expr: WideString): WideString;
procedure BeginDraw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
procedure SetDrawParams(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended);
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
class function GetDescription: String; override;
function Diff(AComponent: TfrxComponent): String; override;
function CalcHeight: Extended; override;
function CalcWidth: Extended; virtual;
function DrawPart: Extended; override;
function GetComponentText: String; override;
function FormatData(const Value: Variant; AFormat: TfrxFormat = nil): WideString;
function WrapText(WrapWords: Boolean): String;
procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
procedure BeforePrint; override;
procedure GetData; override;
procedure AfterPrint; override;
procedure InitPart; override;
procedure ApplyStyle(Style: TfrxStyleItem);
procedure ExtractTotalPages;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -