SHARE
TWEET

Cell Painting

marcibang Nov 19th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     Private Sub CellPainting(sender As Object, e As DataGridViewCellPaintingEventArgs)
  2.  
  3.         If e.RowIndex >= 0 Then
  4.  
  5.             Dim item As cl_SetupUserAccess_SaaS.FeatureItem = sender.rows(e.RowIndex).DataBoundItem
  6.  
  7.             If Not item.Name = "TrialBalance" AndAlso e.ColumnIndex = sender.columns("Add").index Then
  8.  
  9.                 Dim newRect As New Rectangle(e.CellBounds.X + 1, e.CellBounds.Y + 1, e.CellBounds.Width - 4, e.CellBounds.Height - 4)
  10.                 Dim backColorBrush As New SolidBrush(e.CellStyle.BackColor)
  11.                 Dim gridBrush As New SolidBrush(Color.DarkGray)
  12.                 Dim gridLinePen As New Pen(gridBrush)
  13.  
  14.                 ' Erase the cell.
  15.                 e.Graphics.FillRectangle(backColorBrush, e.CellBounds)
  16.  
  17.                 ' Draw the grid lines (only the right and bottom lines;
  18.                 ' DataGridView takes care of the others).
  19.                 e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left, _
  20.                     e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, _
  21.                     e.CellBounds.Bottom - 1)
  22.                 'e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1, _
  23.                 '    e.CellBounds.Top, e.CellBounds.Right - 1, _
  24.                 '    e.CellBounds.Bottom)
  25.  
  26.                 ' Draw the inset highlight box.
  27.                 'e.Graphics.DrawRectangle(New Pen(New SolidBrush(e.CellStyle.SelectionBackColor)), newRect)
  28.  
  29.                 e.Handled = True
  30.  
  31.             End If
  32.  
  33.         End If
  34.  
  35.     End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top