xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xtrareport-b3005d5c.md
Provides access to a collection of the report’s named images.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[SRCategory(ReportStringId.CatData)]
public ImageItemCollection ImageResources { get; }
<SRCategory(ReportStringId.CatData)>
Public ReadOnly Property ImageResources As ImageItemCollection
| Type | Description |
|---|---|
| ImageItemCollection |
A named image collection.
|
Populate this collection with images to use them in the following report controls:
Label
If the AllowMarkupText property is true , you can use the image tag with the name of the image in the collection to display the image in the label text. Example: <image=UpArrow.png>
PictureBox
You can construct the ImageSource property’s expression to set the collection image conditionally.
Cross Tab Cell
If the AllowMarkupText property is true , you can use the image tag with the name of the image in the collection to display the image in the cell text. Example: <image=UpArrow.png>
Click the ImageResources property’s ellipsis button in the Properties window. The Image Resource Collection Editor is invoked. This editor allows you to manipulate with the image collection: add, reorder and remove named images.
When you add an image in the Visual Studio Report Designer, the Image Picker is invoked. It allows you to choose an external image or an image from the DevExpress Image Library.
Visual Studio Image Chooser
DevExpress Raster Image Chooser
DevExpress Vector Image Chooser
You can choose whether to add the selected image to the report or project resources. If you add the image to project resources, you can reuse it in several reports.
Project Resources
Report Resources
When you add an image in the End-User Report Designer, the Open File dialog is invoked.
The selected image is saved to the report definition .repx file.
The code sample below illustrates how to use a report’s image resources to insert an image to a label.
using DevExpress.XtraPrinting.Drawing;
using DevExpress.XtraReports.UI;
using System.Drawing;
// ...
XtraReport report = new XtraReport();
Image image = Image.FromFile("testImage.png");
ImageItem imageItem = new ImageItem("img1", new ImageSource(image));
report.ImageResources.Add(imageItem);
XRLabel label = new XRLabel() {
AllowMarkupText = true,
WordWrap = true,
Text = "Test
" +
"<size=14>Size = 14
" +
"<b>Bold</b> <i>Italic</i> <u>Underline</u></size>
" +
"<size=11>Size = 11
" +
"<color=255,0,0>Sample Text</color></size>
" +
"<href=www.devexpress.com>Hyperlink</href>
" +
"<image=img1>"
};
DetailBand detailBand = new DetailBand();
detailBand.Controls.Add(label);
report.Bands.Add(detailBand);
Imports DevExpress.XtraPrinting.Drawing
Imports DevExpress.XtraReports.UI
Imports System.Drawing
' ...
Dim report As New XtraReport()
Dim image As Image = System.Drawing.Image.FromFile("testImage.png")
Dim imageItem As New ImageItem("img1", New ImageSource(image))
report.ImageResources.Add(imageItem)
Dim label As New XRLabel() With {
.AllowMarkupText = True,
.WordWrap = True,
.Text = "Test
" & "<size=14>Size = 14
" _
& "<b>Bold</b> <i>Italic</i> <u>Underline</u></size>
" _
& "<size=11>Size = 11
" & "<color=255,0,0>Sample Text</color></size>
" _
& "<href=www.devexpress.com>Hyperlink</href>
" & "<image=img1>"}
Dim detailBand As New DetailBand()
detailBand.Controls.Add(label)
report.Bands.Add(detailBand)
See Also