I have a DataGridView
with one button column. When I use the following code with image unblock3.png
the image is displayed, but when I replace it with another image check1.png
nothing is displayed.
I tried resizing check1.png
to smaller size but it still not working.
Could you please help me to figure out what is wrong?
Private Sub ShiftsList_CellPainting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles ShiftsList.CellPainting
If ShiftsList.Columns(e.ColumnIndex).Name = "ConfirmShift" AndAlso e.RowIndex >= 0 Then
e.Paint(e.CellBounds, DataGridViewPaintParts.All)
e.Graphics.DrawImage(My.Resources.unblock3, CInt((e.CellBounds.Width / 2) - (My.Resources.unblock3.Width / 2)) + e.CellBounds.X, CInt((e.CellBounds.Height / 2) - (My.Resources.unblock3.Height / 2)) + e.CellBounds.Y)
e.Handled = True
End If
End Sub