Designer custom controls
Hello,
I would like to create my own controls for the FR report designer. From which base class I have to inherite, and how to register into designer?
In FR 4.x VCL there were base classes for visible controls, dialog controls etc. How is the FR.Net class hierarchy for this?
With best regards - Ulrich Groffy
I would like to create my own controls for the FR report designer. From which base class I have to inherite, and how to register into designer?
In FR 4.x VCL there were base classes for visible controls, dialog controls etc. How is the FR.Net class hierarchy for this?
With best regards - Ulrich Groffy
Comments
FastReport.Net has similar classes. Typically you need to inherit from ReportComponentBase class and do the following:
- define properties;
- override Assign and Serialize methods to assign/store properties;
- override Draw method to draw;
- override GetData method to fill the object with data in run-time.
I'm attaching a simplest CheckBox object source code.
Hello,
thank you for sending me this sample code, but is it possible that the zip file is empty? I can't see anything inside the archive file(?)
How to register the custom control in the designer?
Best regards - Ulrich
/// <summary>
/// Registers an object in the specified category with button's image and text.
/// </summary>
/// <param name="obj">Type of object to register.</param>
/// <param name="category">Name of category to register in.</param>
/// <param name="image">Image for object's button.</param>
/// <param name="text">Text for object's button.</param>
/// <remarks>
/// <para>You must specify either the page type name or existing category name in the category parameter.
/// The report objects must be registered in the "ReportPage" category or custom category that is
/// registered in the "ReportPage" as well. The dialog controls must be registered in the "DialogPage"
/// category or custom category that is registered in the "DialogPage" as well.</para>
/// <para>If you want to register an object that needs to be serialized, but you don't want
/// to show it on the toolbar, pass empty string in the category parameter.
/// </para>
/// </remarks>
/// <example>
/// <code>
/// // register the report object
/// RegisteredObjects.Add(typeof(MyReportObject), "ReportPage", myReportObjectBmp, "My Report Object");
/// // register the dialog control
/// RegisteredObjects.Add(typeof(MyDialogControl), "DialogPage", myDialogControlBmp, "My Dialog Control");
/// // add a category and register an object inside it
/// RegisteredObjects.AddCategory("ReportPage,MyCategory", myCategoryBmp, "My Category");
/// // register another report object in MyCategory
/// RegisteredObjects.Add(typeof(MyReportObject), "ReportPage,MyCategory",
/// anotherReportObjectBmp, "Another Report Object");
/// </code>
/// </example>
public static void Add(Type obj, string category, Bitmap image, string text)
thank you - works so far.
Best regards - Ulrich