#region 添加行序号 /// <summary> /// 添加行序号 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvContact_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { dgvContact.RowHeadersWidth = 50; dgvContact.TopLeftHeaderCell.Value = "序号"; for (int i = 1; i < dgvContact.Rows.Count; i++) { dgvContact.Rows[i - 1].HeaderCell.Value = i.ToString(); } } #endregion
?