I'm using ImageColumn in datagridview to view PNG Pictures saved in DB.
Whenever I change tabs in my Form and go back to the Tab with DGV the PNG imgae transparent background keeps the drawing of the previous Control that was displayed in the same location. Also When I tried to change the Image and save a New PNG image the DGV is updated and it displays parts of the previous picture in the transparent part.
I change Background color and SelectionBackground color in the imageColumn cell default style options to WHITE but nothing is changed. Can any body help me to solve this issue?
Please see pictures for clearance..
Asked
Active
Viewed 647 times
1

Shoshotto
- 93
- 2
- 8
-
I think we need to see the relevant code. And maybe you want to drop either c# or vb.net tag, too? – Mikko Viitala Apr 06 '16 at 15:42
1 Answers
0
Finally Solved by code!
Used CellPaining to draw a white rectangle in the cell.
Private Sub ItemsList_CellPainting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles ItemsList.CellPainting
If ItemsList.Columns(e.ColumnIndex).Name = "iconCol" And e.RowIndex >= 0 Then
e.Paint(e.CellBounds, DataGridViewPaintParts.All)
e.Graphics.FillRectangle(Brushes.White, e.CellBounds.Left, e.CellBounds.Top, e.CellBounds.Width, e.CellBounds.Height)
End If
Don't use DrawRectangle use FillRecangle to draw the rectangle so the background is filled with the color.

Shoshotto
- 93
- 2
- 8