2 回答

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超6個(gè)贊
作為一個(gè)選項(xiàng),您可以自己處理CellPainting事件DataGridView并繪制底部邊框。例如:
private void DataGridView1_CellPainting(object sender,
DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex == -1)
{
e.Paint(e.ClipBounds, e.PaintParts);
using (var pen = new Pen(Color.Red, 10))
e.Graphics.DrawLine(pen, e.CellBounds.Left, e.CellBounds.Bottom,
e.CellBounds.Right, e.CellBounds.Bottom);
e.Handled = true;
}
}

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超4個(gè)贊
我認(rèn)為你可以通過添加行代碼來(lái)改變距離:
dgv.Columns["col1"].HeaderCell.Style.Padding?=?new?Padding(0,?5,?0,?0) dgv.Columns["col2"].HeaderCell.Style.Padding?=?new?Padding(0,?5,?0,?0)
- 2 回答
- 0 關(guān)注
- 149 瀏覽
添加回答
舉報(bào)