B
Barry Mossman
Hi,
I want to alter the default border for specific rows in my grid.
I have found that i can turn off the default border via the PrePaintEvent as
follows:
if ((e.RowIndex > 2) && (e.RowIndex < 6))
{
e.PaintParts &= ~DataGridViewPaintParts.Border;
But how do i paint just the border manually?
Alternatively I can override in the PrePaintEvent via:
if ((e.RowIndex > 2) && (e.RowIndex < 6))
{
dataGridView1.CellBorderStyle =
DataGridViewCellBorderStyle.Sunken;
But this changes the whole grid. If I extend the above to also change the
border style explicitly for the other rows I get the result that i want, but
I get lots of flicker as the event ripples around firing in a loop.
I guess this is because a change to the grid's default border style causes
the grid to repaint. So how do i get access to just the row being painted,
so that I can change only it's border ?
thanks
Barry Mossman
I want to alter the default border for specific rows in my grid.
I have found that i can turn off the default border via the PrePaintEvent as
follows:
if ((e.RowIndex > 2) && (e.RowIndex < 6))
{
e.PaintParts &= ~DataGridViewPaintParts.Border;
But how do i paint just the border manually?
Alternatively I can override in the PrePaintEvent via:
if ((e.RowIndex > 2) && (e.RowIndex < 6))
{
dataGridView1.CellBorderStyle =
DataGridViewCellBorderStyle.Sunken;
But this changes the whole grid. If I extend the above to also change the
border style explicitly for the other rows I get the result that i want, but
I get lots of flicker as the event ripples around firing in a loop.
I guess this is because a change to the grid's default border style causes
the grid to repaint. So how do i get access to just the row being painted,
so that I can change only it's border ?
thanks
Barry Mossman