Back to Devexpress

PrintableComponentContainer.PrintableComponent Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-printablecomponentcontainer.md

latest7.9 KB
Original Source

PrintableComponentContainer.PrintableComponent Property

Specifies a control or a printing link inside the PrintableComponentContainer at runtime.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[Browsable(false)]
[DefaultValue(null)]
public object PrintableComponent { get; set; }
vb
<Browsable(False)>
<DefaultValue(Nothing)>
Public Property PrintableComponent As Object

Property Value

TypeDefaultDescription
Objectnull

A Object value.

|

Remarks

The PrintableComponentContainer allows you to add the following elements to a report:

Create a PrintableComponentContainer class instance. Assign a control or document instance to the container’s PrintableComponent property at runtime. Add the PrintableComponentContainer instance to a report band.

See Use Third-Party Controls 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.

csharp
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);
vb
Imports DevExpress.XtraReports.UI
' ...
' Create an XtraReport instance.
Dim report = New XtraReport()
Dim band = New DetailBand()
report.Bands.Add(band)
' Create a DataGrid control instance.
Dim dataGridView As New DataGridView()
' Create a PrintableComponentContainer instance for the data grid.
Dim printableComponentContainer As 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)

The following code snippets (auto-collected from DevExpress Examples) contain references to the PrintableComponent property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/Funnel/FunnelItemControlProvider.cs#L41

csharp
PrintableComponentContainer container = new PrintableComponentContainer();
container.PrintableComponent = chart;
return container;

winforms-dashboard-custom-items/CS/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.cs#L42

csharp
PrintableComponentContainer container = new PrintableComponentContainer();
container.PrintableComponent = chart;
return container;

winforms-dashboard-trend-line-indicators/CS/WinformsIndicator/Program.cs#L64

csharp
PrintableComponentContainer container = new PrintableComponentContainer();
container.PrintableComponent = grid;
return container;

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/Funnel/FunnelItemControlProvider.vb#L47

vb
Dim container As New PrintableComponentContainer()
container.PrintableComponent = chart
Return container

winforms-dashboard-custom-items/VB/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.vb#L46

vb
Dim container As New PrintableComponentContainer()
container.PrintableComponent = chart
Return container

winforms-dashboard-trend-line-indicators/VB/WinformsIndicator/Program.vb#L72

vb
Dim container As New PrintableComponentContainer()
container.PrintableComponent = grid
Return container

See Also

Use Third-Party Controls

PrintableComponentContainer Class

PrintableComponentContainer Members

DevExpress.XtraReports.UI Namespace