.net 如何在Infragistics.Win.UltraWinGrid中添加imagelist?

.net 如何在Infragistics.Win.UltraWinGrid中添加imagelist?,.net,infragistics,.net,Infragistics,在过去,我使用Listview,并且使用下面的代码可以显示特定memId的特定图像。但现在我需要用Infragistics.Win.UltraWinGrid替换listview 如何显示ultragrid的图像会出现问题 For Each LItem As ListViewItem In Me.dvParticipants.Items If CInt(LItem.SubItems(2).Text) = memid Then LItem.I

在过去,我使用Listview,并且使用下面的代码可以显示特定memId的特定图像。但现在我需要用Infragistics.Win.UltraWinGrid替换listview 如何显示ultragrid的图像会出现问题

 For Each LItem As ListViewItem In Me.dvParticipants.Items
            If CInt(LItem.SubItems(2).Text) = memid Then
                LItem.ImageIndex = imageindex
            End If
        Next

请建议。

我认为您需要为网格的特定列设置图像。我会在网格的InitializeRow事件中这样做。以下是一个示例:

Private Sub ugGrid_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles ugGrid.InitializeRow

    'pull the image from a resource'
    Dim exclamationIcon As Bitmap = My.Resources.Exclamation_Icon_15x15
    exclamationIcon.Tag = EXCLAMATION_ICON_TAG

    'get the data source of the row, I only want this image to appear under certain'
    'conditions    '

    Dim actualHist As ActualHistory = DirectCast(e.Row.ListObject, HistoryRow).ActualHistory
    If Not IsNothing(actualHist) AndAlso actualHist.IsEligible(actualProdHist) Then
        'here the condition is met, set the image on the correct column, the one'
        ' with key of "Descriptor"'
        e.Row.Cells("Descriptor").Appearance.Image = exclamationIcon
        e.Row.Cells("Descriptor").Appearance.ImageHAlign = HAlign.Right
    Else
        e.Row.Cells("Descriptor").Appearance.Image = Nothing
    End If
End Sub