TfrxComponentEditor = class(TObject) protected function AddItem(Caption: String; Tag: Integer; Checked: Boolean = False): TMenuItem; public function Edit: Boolean; virtual; function HasEditor: Boolean; virtual; function Execute(Tag: Integer; Checked: Boolean): Boolean; virtual; procedure GetMenuItems; virtual; property Component: TfrxComponent readonly; property Designer: TfrxCustomDesigner readonly; end;
frxComponentEditors.Register(ComponentClass: TfrxComponentClass; ComponentEditor: TfrxComponentEditorClass);
uses frxClass, frxDsgnIntf, frxBitBtn;type TfrxBitBtnEditor = class(TfrxComponentEditor) public function Edit: Boolean; override; function HasEditor: Boolean; override; function Execute(Tag: Integer; Checked: Boolean): Boolean; override; procedure GetMenuItems; override; end;function TfrxBitBtnEditor.Edit: Boolean;var c: TfrxBitBtnControl;begin Result := False; { Component property is edited component. In this case, it is TfrxBitBtnControl } c := TfrxBitBtnControl(Component); ShowMessage('This is ' + c.Name);end;function TfrxBitBtnEditor.HasEditor: Boolean;begin Result := True;end;function TfrxBitBtnEditor.Execute(Tag: Integer; Checked: Boolean): Boolean;var c: TfrxBitBtnControl;begin Result := True; c := TfrxBitBtnControl(Component); if Tag = 1 then c.Enabled := Checked else if Tag = 2 then c.Visible := Checked;end;procedure TfrxBitBtnEditor.GetMenuItems;var c: TfrxBitBtnControl;begin c := TfrxBitBtnControl(Component); { AddItem method parameters: menu item name, its tag and Checked/Unchecked condition } AddItem('Enabled', 1, c.Enabled); AddItem('Visible', 2, c.Visible);end;initialization frxComponentEditors.Register(TfrxBitBtnControl, TfrxBitBtnEditor);end.
如果您对 FastReport 感兴趣,欢迎加入 FastReport QQ 交流群:702295239
还想要更多吗可以点击阅读【FastReport 表2021最新资源盘点】,查找需要的教程资源。上是FastReport .NET慧正在 火热销售中!>>查看价格详情
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!