The C1ReportDesigner control displays reports in design mode, and allows users to drag, copy, and resize report fields and sections. The control also provides an unlimited undo/redo stack and a selection mechanism designed for use with the PropertyGrid control that ships with Visual Studio.
You can use the C1ReportDesigner control to incorporate some report design features into your applications, or you can write your own full-fledged report designer application. We include full source code for the C1ReportDesigner application that ships with Reports for WinForms and uses the C1ReportDesigner control extensively.
Writing your own customized report designer is useful in many situations, for example:
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:
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.
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.
For the complete project, see the SimpleDesigner sample, which is installed in the ComponentOne Samples folder.