【发布时间】:2014-08-07 13:24:53
【问题描述】:
有谁知道如何在 Visual Studio .Net 中使用 DataGridView 的图标来编写“删除图像按钮”
我很难找到试图让我的最后一列有一个删除图标而不是“删除”这个词,我想显示一个小垃圾箱图标。
我已经尝试在很多地方寻找,但我无法让它发挥作用。
Private Sub dataGridView1_CellPainting(ByVal sender As Object, ByVal e As
DataGridViewCellPaintingEventArgs)
If e.ColumnIndex = 1 AndAlso e.RowIndex >= 0 Then
e.Paint(e.CellBounds, DataGridViewPaintParts.All)
Dim img As Image = Image.FromFile("C:\icon_delete.jpg")
e.Graphics.DrawImage(img, e.CellBounds.Left + 10, e.CellBounds.Top + 5, 10, 10)
e.Handled = True
End If
End Sub
如果有人知道,将不胜感激。提前致谢。库尔迪普。
【问题讨论】:
标签: .net vb.net datagridview imagebutton