PrintableComponentContainer Class
A container that is used to add DevExpress controls, Windows Forms controls, controls that implement the IPrintable interface, and documents created using printing links to a report.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
Remarks
Use PrintableComponentContainer to add the following items to a report:
- DevExpress controls
- Windows Forms controls
- Controls that implement the IPrintable interface
- Documents created with printing links
Create a PrintableComponentContainer class instance. Assign a control or document instance to the PrintableComponent property at runtime. Add the PrintableComponentContainer instance to a report band.
The following properties specify how to render a control inside the PrintableComponentContainer:
- WindowControlOptions.DrawMethod - gets or sets which message should be used to paint a control.
- WindowControlOptions.PrintMode - gets or sets if a control is printed as a brick or image.
- WindowControlOptions.ImageType - gets or sets whether to render a control as a bitmap or metafile. This property is in effect when the WindowControlOptions.PrintMode property is set to AsImage.
- The PrintableComponentChanged event occurs when a new control is assigned to the container.
See the Use Third-Party Controls topic for more information.
Example
The code sample below creates a DataGridView control instance and adds this instance to a report. The sample specifies that the DataGridView control is printed as a bitmap image.
using DevExpress.XtraReports.UI;
using System.Windows.Forms;
// ...
// Create an XtraReport instance.
XtraReport report = new XtraReport()
{
Bands = {
new DetailBand()
}
};
// Create a DataGrid control instance.
DataGridView dataGridView = new DataGridView();
// Create a PrintableComponentContainer instance for the data grid.
PrintableComponentContainer printableComponentContainer = new PrintableComponentContainer();
// Place the data grid inside the printable component container.
printableComponentContainer.WinControl = dataGridView;
// Specify that the control inside the printable component container is always printed as an image.
printableComponentContainer.PrintMode = WinControlPrintMode.AsImage;
// Specify that the control inside the printable component container is always printed as a bitmap.
printableComponentContainer.WindowControlOptions.ImageType = WinControlImageType.Bitmap;
// Add the printable component container to the report.
report.Bands[BandKind.Detail].Controls.Add(printableComponentContainer);