XRPictureBox.Sizing Property
Specifies the image displaying mode in the Picture Box control.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v18.2.dll
Declaration
[SRCategory(ReportStringId.CatBehavior)]
[DefaultValue(ImageSizeMode.Normal)]
public ImageSizeMode Sizing { get; set; }
<SRCategory(ReportStringId.CatBehavior)>
<DefaultValue(ImageSizeMode.Normal)>
Public Property Sizing As ImageSizeMode
Property Value
Type | Default | Description |
---|---|---|
ImageSizeMode | Normal |
One of the ImageSizeMode enumeration values that specifies how the image is displayed in the control. |
Remarks
Use this property to specify how the image should be displayed within the XRPictureBox control.
Illustration | Description |
---|---|
The image is displayed with its original dimensions. | |
The image is stretched to fill both the control's width and height. | |
The control's dimensions are auto-adjusted to the image size. | |
The image is proportionally resized, so that it fits the control. | |
If the control's dimensions exceed the image size, the image is centered and shown full-size. Otherwise, the image is resized to fit into the control's dimensions. | |
The original image is replicated within the picture control starting from the upper-left corner. The replicated image is clipped if it does not fit in the picture control which contains it. |
To display the image in the middle of the control, set the XRPictureBox.Sizing property to ImageSizeMode.Normal and the XRPictureBox.ImageAlignment property to ImageAlignment.MiddleCenter.
Examples
This example demonstrates how to create an XRPictureBox object, and set some of its properties.
using System.Drawing;
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Drawing;
// ...
public XRPictureBox CreateXRPictureBox()
{
// Create an XRPictureBox object.
XRPictureBox xrPictureBox = new XRPictureBox();
// Set its image.
xrPictureBox.ImageSource = new ImageSource(new Bitmap("C:\\test.bmp"));
// Uncomment these lines to get images from a data source.
// ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "ImageSource", "[Picture]");
// xrPictureBox.ExpressionBindings.Add(expressionBinding);
// Set its location.
xrPictureBox.LocationF = new PointF(150F, 25F);
// Set its size.
xrPictureBox.SizeF = new SizeF(160F, 120F);
// Set its size mode.
xrPictureBox.Sizing = ImageSizeMode.AutoSize;
return xrPictureBox;
}