Skip to main content

XRPictureBox.UseImageResolution Property

Gets or sets whether to use the original image DPI (dots per inch) value when the image is rendered in a report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[Browsable(false)]
[DefaultValue(true)]
[SRCategory(ReportStringId.CatBehavior)]
public bool UseImageResolution { get; set; }

Property Value

Type Default Description
Boolean true

true, to use the original image resolution; otherwise, false.

Remarks

Set this property to false to use images that have no DPI settings, and to render these images with the same size on any device.

When this property is set to false, the value of 96 DPI is used.

Set this property to true to use the DPI value specified in the image. Call the SetResolution(Single, Single) method to specify a custom resolution for an image.

Example

This example demonstrates how to create an XRPictureBox object and specify its properties.

using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Drawing;
using DevExpress.XtraReports.UI;
using System.Drawing;
// ...
public XRPictureBox CreateXRPictureBox()
{
    // Create an XRPictureBox instance.
    XRPictureBox xrPictureBox = new XRPictureBox();

    // Specify an image for the created XRPictureBox instance.
    xrPictureBox.ImageSource = ImageSource.FromFile("Images\\Flags\\United_States_of_America.png");
    // Uncomment these lines to get images from a data source.
    // ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "ImageSource", "[Picture]");
    // xrPictureBox.ExpressionBindings.Add(expressionBinding);

    // Position the picture box within a document.
    xrPictureBox.LocationF = new PointF(150F, 25F);

    // Set the picture box size.
    xrPictureBox.SizeF = new SizeF(160F, 120F);

    // Set the picture box size mode.
    xrPictureBox.Sizing = ImageSizeMode.AutoSize;

    // Specify that the image in the picture box should use the default DPI value.
    xrPictureBox.UseImageResolution = false;

    return xrPictureBox;
}
See Also