Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Change the Border of a Full Selected Row

$
0
0
 Hi All,

I'm trying to do the following:

I have a datagridview with a fullrowselected selection mode, and I would like to change the full row border when selected, I've tried:

Private

Sub DGCAL_CellPainting(ByVal sender AsObject, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DGCAL.CellPainting

If e.RowIndex = DGCAL.CurrentRow.Index Then
  e.Paint(e.CellBounds, DataGridViewPaintParts.Border)
  Using p = New Pen(Color.Black, 4)
     Dim rect As Rectangle = e.CellBounds
     rect.Width -= 2
     rect.Height -= 2
     e.Graphics.DrawRectangle(p, rect)
  EndUsing
  e.Handled = True
EndIf

EndSub

But I get borders in all cells inside the row insted of a single border all over the row, any suggestion would be eternally appreciated.

Thanks in advance



Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>