FastReport VCL如何为属性创建编辑器?

本文介绍了如何在FastReport VCL中为组件属性创建自定义编辑器,包括如何继承基本类并重写方法,以实现如字体、颜色和样式属性的特殊编辑效果。FastReport VCL 提供了可视化报告设计器和多种属性编辑器基类,允许开发者定制组件属性的编辑体验。
摘要由CSDN通过智能技术生成

FastReport VCL是用于 Delphi、C++ Builder、RAD Studio 和 Lazarus 的报告和文档创建 VCL 库。它提供了可视化模板设计器,可以访问 30 多种格式,并可以部署到云、网站、电子邮件和打印中。

立即点击下载FastReport VCL v6.9最新版

当你在设计器中选择一个组件时,它的属性会显示在对象检查器中。你可以为任何属性创建你自己的编辑器。"字体 "属性的标准编辑器可以作为例子:如果这个属性被选中,在行的右侧出现…按钮;通过点击这个按钮调用标准的 "字体属性 "对话框。还有一个例子是 "颜色 "属性编辑器。它在下拉列表中显示标准颜色和颜色规格名称。

所有属性编辑器的基类在 "frxDsgnIntf "单元中描述。

TfrxPropertyEditor = class(TObject)
protected
procedure GetStrProc(const s: String);
function GetFloatValue: Extended;
function GetOrdValue: Integer;
function GetStrValue: String;
function GetVarValue: Variant;
procedure SetFloatValue(Value: Extended);
procedure SetOrdValue(Value: Integer);
procedure SetStrValue(const Value: String);
procedure SetVarValue(Value: Variant);
public
constructor Create(Designer: TfrxCustomDesigner); virtual;
destructor Destroy; override;
function Edit: Boolean; virtual;
function GetAttributes: TfrxPropertyAttributes; virtual;
function GetExtraLBSize: Integer; virtual;
function GetValue: String; virtual;
procedure GetValues; virtual;
procedure SetValue(const Value: String); virtual;
procedure OnDrawLBItem(Control: TWinControl; Index: Integer; ARect: TRect; State: TOwnerDrawState); virtual;
procedure OnDrawItem(Canvas: TCanvas; ARect: TRect); virtual;
property Component: TPersistent readonly;
property frComponent: TfrxComponent readonly;
property Designer: TfrxCustomDesigner readonly;
property ItemHeight: Integer;
property PropInfo: PPropInfo readonly;
property Value: String;
property Values: TStrings readonly;
end;
你也可以继承以下任何一个类,这些类本身实现了一些处理相应类型的属性的基本功能。
TfrxIntegerProperty = class(TfrxPropertyEditor)
TfrxFloatProperty = class(TfrxPropertyEditor)
TfrxCharProperty = class(TfrxPropertyEditor)
TfrxStringProperty = clas

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值