C# DataGridView从第一列中删除网格线
我正在尝试删除datagridview中第一列上的网格线,因此看起来如下所示:C# DataGridView从第一列中删除网格线,c#,datagridview,C#,Datagridview,我正在尝试删除datagridview中第一列上的网格线,因此看起来如下所示: 不幸的是,我只在行/单元格的基础上删除了行,但我需要的是删除整个列的行,但保留右侧行,有没有标准的方法来实现这一点?一个棘手的问题是在特定列下的Datagridview Paint事件上递归更改单元格样式。使用for循环来操作单元格边框样式。以下代码必须满足您的要求 private void dataGridView1_CellPainting(object sender, DataGridView
不幸的是,我只在行/单元格的基础上删除了行,但我需要的是删除整个列的行,但保留右侧行,有没有标准的方法来实现这一点?一个棘手的问题是在特定列下的Datagridview Paint事件上递归更改单元格样式。使用for循环来操作单元格边框样式。以下代码必须满足您的要求
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == 0 && e.RowIndex > -1)
{
e.AdvancedBorderStyle.Left = DataGridViewAdvancedCellBorderStyle.None;
e.AdvancedBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.None;
e.AdvancedBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.None;
}
}