答案 0 :(得分:0)
要隐藏行标题中的指针,您需要执行以下操作..
使用以下代码添加RowPrePaint
和CellFormatting
事件处理程序..
private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
e.PaintCells(e.ClipBounds, DataGridViewPaintParts.All);
e.PaintHeader(DataGridViewPaintParts.Background
| DataGridViewPaintParts.Border
| DataGridViewPaintParts.Focus
| DataGridViewPaintParts.SelectionBackground
| DataGridViewPaintParts.ContentForeground);
e.Handled = true;
}
您可以使用以下内容添加索引号。
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
this.dataGridView1.Rows[e.RowIndex].HeaderCell.Value = e.RowIndex.ToString();
}