0
我有一個按鈕列的datagridview。當我使用帶有圖像「unblock3.png」的follwing代碼時,會顯示圖像,但是當我用另一個圖像「check1.png」替換它時,不顯示任何內容。Datagridview按鈕列未在油漆上顯示圖像VB.NET
我嘗試將check1.png調整爲較小的大小,但仍然無法正常工作。
你能幫我弄清楚什麼是錯的嗎?在此先感謝
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