windowsforms-devexpress-dot-xtraeditors-dot-baselistboxcontrol-e522dfbd.md
Gets or sets a collection of images that can be inserted into item captions using the image tag.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DefaultValue(null)]
[DXCategory("Appearance")]
public object HtmlImages { get; set; }
<DefaultValue(Nothing)>
<DXCategory("Appearance")>
Public Property HtmlImages As Object
| Type | Default | Description |
|---|---|---|
| Object | null |
An image collection (DevExpress.Utils.ImageCollection or DevExpress.Utils.SvgImageCollection).
|
Enable the BaseListBoxControl.AllowHtmlDraw property to use a set of HTML-inspired tags to format the display text of the control’s items.
When you compose an HTML string, you can use the image tag to insert an image from an image collection and project’s resources into the text.
To insert an image from an image collection, do the following:
See HTML Text Formatting to learn more.
The following code shows how to create items for a ListBoxControl and format the items’ display text using HTML tags. The image HTML tag is used to insert an image into an item’s text from an ImageCollection, assigned to the BaseListBoxControl.HtmlImages property. The HTML formatting feature is activated via the BaseListBoxControl.AllowHtmlDraw feature.
listBoxControl1.ItemHeight = 20;
listBoxControl1.HtmlImages = imageCollection1;
listBoxControl1.AllowHtmlDraw = DefaultBoolean.True;
for (int i = 0; i < imageCollection1.Images.Count; i++) {
string item = String.Format("id: {0} - <image={1}>", i, imageCollection1.Images.InnerImages[i].Name);
listBoxControl1.Items.Add(item);
}
listBoxControl1.ItemHeight = 20
listBoxControl1.HtmlImages = imageCollection1
listBoxControl1.AllowHtmlDraw = DefaultBoolean.True
Dim i As Integer = 0
Do While i < imageCollection1.Images.Count
Dim item As String = String.Format("id: {0} - <image={1}>", i, imageCollection1.Images.InnerImages(i).Name)
listBoxControl1.Items.Add(item)
i += 1
Loop
See Also