xtrareports-devexpress-dot-xtrareports-dot-ui-dot-windowcontroloptions-cd264e37.md
Gets or sets whether to render a control inside the PrintableComponentContainer as a bitmap or metafile.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[DefaultValue(WinControlImageType.Metafile)]
public WinControlImageType ImageType { get; set; }
<DefaultValue(WinControlImageType.Metafile)>
Public Property ImageType As WinControlImageType
| Type | Default | Description |
|---|---|---|
| WinControlImageType | Metafile |
An enumeration value that specifies whether to render a control inside the PrintableComponentContainer as a bitmap or metafile.
|
Available values:
| Name | Description |
|---|---|
| Metafile |
The control is rendered as a metafile. In this case the quality of the rendered image is always good, but in some cases some details of the control may be lost.
| | Bitmap |
The control is rendered as a bitmap. In this case the quality of the rendered image is sometimes poor, but it allows a control to be drawn more precisely.
|
You can access this nested property as listed below:
| Object Type | Path to ImageType |
|---|---|
| PrintableComponentContainer |
.WindowControlOptions .ImageType
|
This property is in effect when a control inside the PrintableComponentContainer is rendered as an image. See the PrintMode property description for more information.
Use the ImageType property to specify whether to render a control inside the container as a metafile image or as a bitmap. A meta file’s image quality is always good, but certain parts of the control may be lost. A bitmap’s quality may be poorer, but a control is rendered more accurately.
The following images demonstrate how controls are rendered to metafiles or bitmaps.
| System.Windows.Forms control | ImageType = Metafile | ImageType = Bitmap |
|---|---|---|
| Button | ||
| TextBox with some text |
Note
To ensure Microsoft Azure compatibility, set the ImageType property to WinControlImageType.Bitmap.
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);
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)
See Also