Back to Devexpress

WindowControlOptions.DrawMethod Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-windowcontroloptions.md

latest4.8 KB
Original Source

WindowControlOptions.DrawMethod Property

Gets or sets which message should be used to paint a control inside the PrintableComponentContainer.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[DefaultValue(WinControlDrawMethod.UseWMPaint)]
public WinControlDrawMethod DrawMethod { get; set; }
vb
<DefaultValue(WinControlDrawMethod.UseWMPaint)>
Public Property DrawMethod As WinControlDrawMethod

Property Value

TypeDefaultDescription
WinControlDrawMethodUseWMPaint

The message that should be used to paint a control inside the PrintableComponentContainer.

|

Available values:

NameDescription
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.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to DrawMethod
PrintableComponentContainer

.WindowControlOptions .DrawMethod

|

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.

csharp
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);
vb
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

Use Third-Party Controls

WindowControlOptions Class

WindowControlOptions Members

DevExpress.XtraReports.UI Namespace