WinControlContainer.DrawMethod Property
Gets or sets which message should be used to paint a control placed inside the WinControlContainer.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v19.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
[SRCategory(ReportStringId.CatBehavior)]
[DefaultValue(WinControlDrawMethod.UseWMPaint)]
public virtual WinControlDrawMethod DrawMethod { get; set; }
Property Value
Type | Default | Description |
---|---|---|
WinControlDrawMethod | UseWMPaint | The message that should be used to paint a control placed in the WinControlContainer. |
Available values:
Name | Description |
---|---|
UseWMPaint | Use the WM_PAINT message to draw the Windows Forms control. |
UseWMPrint | Use the WM_PRINT message to draw the Windows Forms control. |
UseWMPaintRecursive | Use the WM_PAINT message to recursively draw the Windows Forms control and all its child controls. |
UseWMPrintRecursive | Use the WM_PRINT message to recursively draw the Windows Forms control and all its child controls. |
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);
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DrawMethod 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.