A newer version of this page is available. Switch to the current version.

XRControl.ToImage(TextRenderingHint) Method

Returns a control's graphical representation created using the specified text rendering mode.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll


public virtual Image ToImage(
    TextRenderingHint textRenderingHint
Public Overridable Function ToImage(
    textRenderingHint As TextRenderingHint
) As Image


Name Type Description
textRenderingHint TextRenderingHint

One of the TextRenderingHint values that specifies the text rendering mode.


Type Description

A Image object which represents a graphical representation of a control.


Use the ToImage method to obtain an image from any report control. Later, this image can be used either for a Web representation of the control, or saved to a file for future use. The text rendering hint specifies whether text is rendered with antialiasing.


A control can't be saved to an image if it doesn't belong to a report. Therefore, if you're creating a separate report control, first add the control to any report to call the ToImage method.


The following code demonstrates how to use the ToImage method. It first creates a label, sets a couple of its properties, adds it to the label, and then creates an image of the label and saves it to a file.

using System.Drawing;
using DevExpress.XtraReports.UI;
// ...

public void CreateControlImage() {
    // Create a label and adjust its properties.
    XRLabel label = new XRLabel();
    label.BackColor = Color.Red;
    label.Text = "XRLabel";

    // Create an empty report and add a label to it.
    XtraReport report = new XtraReport();
    report.Bands.Add(new DetailBand());

    // Create an image from the label and save it to a disk.
    Image img = label.ToImage();
See Also