private void dgvList_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { //=============================== //그리드 행번호 입력하는 부분 //=============================== if (e.ColumnIndex = 0) { e.Paint(e.ClipBounds, DataGridViewPaintParts.All); Rectangle _rect = e.CellBounds; _rect.Inflate(-2, -2); TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), e.CellStyle.Font, _rect, e.CellStyle.ForeColor, TextFormatFlags.Right); e.Handled = true; } }