如何在 Infragistics.Win.UltraWinGrid 中添加图像列表?

发布于 2024-08-26 09:20:50 字数 352 浏览 4 评论 0原文

过去,我使用 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

请建议。

In past, I am using Listview and using below code can show a particular 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷鸟归林 2024-09-02 09:20:50

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文