WinControlContainer Class

A container that is used to embed a Control class instance or descendants into a report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v21.1.dll

Declaration

public class WinControlContainer :
    XRControl

Remarks

Use this class to add a Windows Forms control to a report. Use the PrintableComponentContainer class to add DevExpress controls, IPrintable controls, or printing links.

Create a WinControlContainer class instance to add a control to a report. Assign the control instance to the WinControl property. Add the WinControlContainer instance to a report band.

You can specify how to render a control inside the WinControlContainer:

  • The PrintMode property specifies whether to render a control as a Printing System brick or as an image.
  • The ImageType property specifies if the image is a bitmap or a metafile. This property is in effect when a control is rendered as an image. See the PrintMode property description for more information.
  • The SyncBounds property specifies if a control should synchronize its bounds with the container’s bounds.
  • The WinControlChanged event occurs when a new control is assigned to the container.

See the Use Third-Party Controls topic for 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);
See Also