mond007
Active member
Hi
Does anyone know how to programme up a ?Delete Image Button? using an Icon for a DataGridView in Visual Studio .Net
I am struggling find trying to get my last column in my DataGridview to have a delete icon instead of the a "Delete Button" and I want to display a little dustbin icon.
I have tried looking exhaustively in many forums and can find #c examples but not .NET. I am unable to get this to work.
Would appreciate some help if anyone knows. Thanks in Advance. Kuldip.
Does anyone know how to programme up a ?Delete Image Button? using an Icon for a DataGridView in Visual Studio .Net
I am struggling find trying to get my last column in my DataGridview to have a delete icon instead of the a "Delete Button" and I want to display a little dustbin icon.
I have tried looking exhaustively in many forums and can find #c examples but not .NET. I am unable to get this to work.
VB.NET:
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
Would appreciate some help if anyone knows. Thanks in Advance. Kuldip.