【问题标题】:How add imagelist in Infragistics.Win.UltraWinGrid?如何在 Infragistics.Win.UltraWinGrid 中添加图像列表?
【发布时间】:2010-03-23 13:00:33
【问题描述】:

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

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

请提出建议。

【问题讨论】:

    标签: .net infragistics


    【解决方案1】:

    我认为您会想要为网格的特定列设置图像。我会在网格的 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
    

    【讨论】:

      猜你喜欢
      • 2020-06-23
      • 2022-01-17
      • 2012-09-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多