开发者

How add imagelist in Infragistics.Win.UltraWinGrid?

开发者 https://www.devze.com 2022-12-24 14:32 出处:网络
In past, I am using Listview and using below code can show a particu开发者_如何学Golar image for particular memId. But now I need to replace listview with Infragistics.Win.UltraWinGrid

In past, I am using Listview and using below code can show a particu开发者_如何学Golar image for particular memId. But now I need to replace listview with Infragistics.Win.UltraWinGrid problem arise how i show image for ultragrid.

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

Please suggest.


I think you will want to set an image for a specific column of your grid. I would do this in InitializeRow event of the grid. Here is a sample:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号