For the control to use the ImageList property, you must put an ImageList component on the form. Then, at design time, you can set the ImageList property in the associated control's property page from the drop down box containing the names of all the ImageList controls currently on the form. To associate an ImageList with a control at run time, set the control's ImageList property to the ImageList component you want to use, as in this example:
Set UltraWinGrid1.ImageList = ImageList1
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button89_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button89.Click ' Set the ImageList property to an isntance of ImageList. Typically the way ' you create an ImageList is to add an ImageList component on the form and add ' images to it through the designer. Me.UltraGrid1.ImageList = New System.Windows.Forms.ImageList() Dim image As Image = Nothing Try ' Open an image. image = Image.FromFile("d:\\test.bmp") Catch exc As Exception MessageBox.Show(Me, exc.Message, "Error opening file.", MessageBoxButtons.OK, MessageBoxIcon.Error) Return End Try ' Add the image to the image list. Dim imageIndex As Integer = Me.UltraGrid1.ImageList.Images.Add(image, Color.Transparent) ' Set the Image properties of various appearances to the index of the image ' in the ultra grid. Me.UltraGrid1.DisplayLayout.Override.RowSelectorAppearance.Image = imageIndex Me.UltraGrid1.DisplayLayout.Override.HeaderAppearance.Image = imageIndex ' You can also set the Image properties to the image itself. Me.UltraGrid1.DisplayLayout.Override.CellAppearance.Image = Me.UltraGrid1.ImageList.Images(0) End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button89_Click(object sender, System.EventArgs e) { // Set the ImageList property to an isntance of ImageList. Typically the way // you create an ImageList is to add an ImageList component on the form and add // images to it through the designer. this.ultraGrid1.ImageList = new System.Windows.Forms.ImageList( ); Image image = null; try { // Open an image. image = Image.FromFile( "d:\\test.bmp" ); } catch ( Exception exc ) { MessageBox.Show( this, exc.Message, "Error opening file.", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } // Add the image to the image list. int imageIndex = this.ultraGrid1.ImageList.Images.Add( image, Color.Transparent ); // Set the Image properties of various appearances to the index of the image // in the ultra grid. this.ultraGrid1.DisplayLayout.Override.RowSelectorAppearance.Image = imageIndex; this.ultraGrid1.DisplayLayout.Override.HeaderAppearance.Image = imageIndex; // You can also set the Image properties to the image itself. this.ultraGrid1.DisplayLayout.Override.CellAppearance.Image = this.ultraGrid1.ImageList.Images[0]; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2