2016-10-15 74 views
1

双下划线单元格DataGridView与此图像类似如何?
我想显示最后一排个,并且在DataGridView总的细胞应在下划线或某些边界在电池的底DataGridView双下划线单元格

enter image description here

+0

我想显示最后一排个,并且在datagridview的总的细胞应该是在底部下划线或一些边境的细胞@RezaAghaei –

回答

2

您可以处理CellPainting事件的DataGridView,并在底部绘制一个双边框指定行的是这样的:

void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) 
{ 
    if (e.RowIndex == 1 && e.ColumnIndex >= 0) 
    { 
     e.Paint(e.CellBounds, e.PaintParts); 
     e.Graphics.DrawLine(Pens.Black, e.CellBounds.Left, 
      e.CellBounds.Bottom - 2, e.CellBounds.Right, e.CellBounds.Bottom - 2); 
     e.Graphics.DrawLine(Pens.Black, e.CellBounds.Left, 
      e.CellBounds.Bottom - 4, e.CellBounds.Right, e.CellBounds.Bottom - 4); 
     e.Handled = true; 
    } 
} 

enter image description here

同样作为您可以设置指定行的DividerHeight到一个较大的值等选项:

this.categoryDataGridView.Rows[1].DividerHeight = 5; 

enter image description here

+0

谢谢你解决了这个问题。 @Reza –

+0

不客气:) –