ComponentOne Reports for WinForms Designer Edition: Using the C1ReportDesigner Control

Using the C1ReportDesigner Control

To use the C1ReportDesigner control, simply add it to a form, add a C1Report component that will contain the report you want to edit, and set the Report property in the designer control.

When you run the project, you will see the report definition in design mode. You will be able to select, move, and resize the report fields and sections. Any changes made through the designer will be reflected in the report definition stored in the C1Report component. You can save the report at any time using the C1Report.Save method, or preview it using the C1Report.Document property and a Preview control.

To build a complete designer, you will have to add other user interface elements:

      A PropertyGrid control attached to the designer selection, so the user can change field and section properties.

      A DataSource selection mechanism so the user can edit and change the report data source.

      A Group Editor dialog box if you want to allow the user to create, remove, and edit report groups.

      A Wizard to create new reports.

      The usual file and editing commands so users can load and save reports, use the clipboard, and access the undo/redo mechanism built into the C1ReportDesigner control.

Most of these elements are optional and may be omitted depending on your needs. The Report Designer application source code implements all of these, and you can use the source code as a basis for your implementation.

About this section

This section describes how to implement a simple report designer using the C1ReportDesigner control. The purpose of the sample designer is to illustrate how the C1ReportDesigner control integrates with a designer application. It supports loading and saving files with multiple reports, editing and previewing reports, adding and removing reports from the file, and report editing with undo/redo and clipboard support.

Most designer applications based on the C1ReportDesigner control will have features similar to the ones described here. If you follow these steps, you will become familiar with all the basic features of the C1ReportDesigner control.

The sample designer does not provide some advanced capabilities such as import/export, data source selection/editing, and group editing. All these features are supported by the full version of the C1ReportDesigner application, and you can refer to the source code for details on how to implement them.

The following sections describe the step-by-step implementation of the sample designer.

* Sample Report Available

For the complete project, see the SimpleDesigner sample, which is available for download from the ComponentOne HelpCentral Sample page.


Step 1 of 9: Create and Populate the Main Form

Step 2 of 9: Add Class Variables and Constants

Step 3 of 9: Add Code to Update the User Interface

Step 4 of 9: Add Code to Handle the Toolbar Commands

Step 5 of 9: Implement the SetDesignMode Method

Step 6 of 9: Implement the File Support Methods

Step 7 of 9: Hook Up the Controls

Step 8 of 9: Add Code to Create and Remove Reports

Step 9 of 9: Add Code to Create Fields


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.