WinControlContainer.ImageType Property
Gets or sets whether to render a control inside the WinControlContainer as a bitmap or as a metafile.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v19.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
[DefaultValue(WinControlImageType.Metafile)]
[SRCategory(ReportStringId.CatBehavior)]
public virtual WinControlImageType ImageType { get; set; }
Property Value
Type | Default | Description |
---|---|---|
WinControlImageType | Metafile | A value that specifies whether to render a control inside the WinControlContainer as a bitmap or as a 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. |
Remarks
This property is in effect when a control inside the WinControlContainer 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 metafile’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 or set the AzureCompatibility.Enable property to true.
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 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 WinControlContainer instance for the data grid.
WinControlContainer winControlContainer = new WinControlContainer();
// Place the data grid inside the WinControlContainer.
winControlContainer.WinControl = dataGridView;
// Specify that the WM_PAINT message is used to print the control inside the WinControlContainer.
winControlContainer.DrawMethod = WinControlDrawMethod.UseWMPaint;
// Specify that the control inside the WinControlContainer is always printed as an image.
winControlContainer.PrintMode = WinControlPrintMode.AsImage;
// Specify that the printed image is a bitmap, not a metafile.
winControlContainer.ImageType = WinControlImageType.Bitmap;
// Specify that the control should synchronize its bounds with the WinControlContainer's bounds.
winControlContainer.SyncBounds = true;
// Add the printable component container to the report.
report.Bands[BandKind.Detail].Controls.Add(winControlContainer);