WindowControlOptions.ImageType Property

Gets or sets whether to render a control inside the PrintableComponentContainer as a bitmap or metafile.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v20.2.dll

Declaration

[DefaultValue(WinControlImageType.Metafile)]
public WinControlImageType ImageType { get; set; }
<DefaultValue(WinControlImageType.Metafile)>
Public Property ImageType As WinControlImageType

Property Value

Type Default Description
WinControlImageType

Metafile

An enumeration value that specifies whether to render a control inside the PrintableComponentContainer as a bitmap or metafile.

Property Paths

You can access this nested property as listed below:

Object Type Path to ImageType
PrintableComponentContainer

Remarks

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 WinControl.Button.Metafile.png WinControl.Button.Bitmap.png
TextBox with some text WinControl.TextBox.Metafile.png WinControl.TextBox.Bitmap.png
NOTE

To ensure Microsoft Azure compatibility, set the ImageType property to WinControlImageType.Bitmap or set the AzureCompatibility.Enable property to true.

Examples

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 System.Windows.Forms;
using DevExpress.XtraReports.UI;
// ...
// Create an XtraReport instance.
XtraReport report = new XtraReport() {
    Bands = {
        new DetailBand()
    }
};
// Create a DataGridView 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.PrintableComponent = dataGridView;
// Specify that the WM_PRINT message is used to print the control inside the printable component container.
printableComponentContainer.WindowControlOptions.DrawMethod = WinControlDrawMethod.UseWMPrint;
// Specify that the control inside the printable component container is always printed as an image.
printableComponentContainer.WindowControlOptions.PrintMode = WinControlPrintMode.AsImage;
// Specify that the printed image is a bitmap, not a metafile.
printableComponentContainer.WindowControlOptions.ImageType = WinControlImageType.Bitmap;
// Add the printable component container to the report.
report.Bands[BandKind.Detail].Controls.Add(printableComponentContainer);
See Also