After incorporating the Img Wanted to display Normal Gridlines or all the Cells in DGV with Borders and
respective Cell Values in Front of the Image
Below Tried almost everything but did not achieve anything.
I am not able to see the Each Cell All Borders of DGV3 as Background image already in corporated in DGV3 with below coding.
Your guidance will be appreciated
Private bgImage As Drawing.Image
Public Sub New()
bgImage = Drawing.Image.FromFile("C:ImagesVPBSSquare.Jpg")
ResizeImage(bgImage)
End Sub
Private Sub DataGridView3_Paint(sender As Object, e As PaintEventArgs) Handles DataGridView3.Paint
e.Graphics.DrawImage(bgImage, 0, 0, 228, 228)
End Sub
Private Sub DataGridView3_CellPainting(sender As Object, e As DataGridViewCellPaintingEventArgs) Handles DataGridView3.CellPainting
'Option 1
DataGridView3.DefaultCellStyle.SelectionBackColor = Color.Transparent
e.Graphics.DrawLine(Pens.Black, e.CellBounds.Left, e.CellBounds.Top, e.CellBounds.Right, e.CellBounds.Top)
e.Graphics.DrawLine(Pens.Black, e.CellBounds.Left, e.CellBounds.Bottom - 1, e.CellBounds.Right, e.CellBounds.Bottom - 1)
'OPtion 2
Dim columnindex As Integer
If e.RowIndex <> -1 AndAlso e.ColumnIndex = columnIndex Then
If (e.PaintParts And DataGridViewPaintParts.Background) <> DataGridViewPaintParts.None Then
e.Graphics.DrawImage(bgImage, e.CellBounds)
End If
If Not e.Handled Then
e.Handled = True
e.PaintContent(e.CellBounds)
End If
End If
End Sub
Private Sub DataGridView3_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles DataGridView2.CellFormatting
'Option 3
e.CellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
DataGridView3.BorderStyle = BorderStyle.Fixed3D
DataGridView3.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single
DataGridView3.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single
DataGridView3.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised
End Sub
Thanks SsD
I tried each and every Option as above. Did not achieve anything