You can render row numbers for DataGridView and DataGridViewX by handling RowPostPaint event. Then you use following code:
void DataGridViewRowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
DataGridView dg = (DataGridView)sender;
// Current row record
string rowNumber = (e.RowIndex + 1).ToString();
// Format row based on number of records displayed by using leading zeros
while (rowNumber.Length < dg.RowCount.ToString().Length) rowNumber = "0" + rowNumber;
// Position text
SizeF size = e.Graphics.MeasureString(rowNumber, this.Font);
if (dg.RowHeadersWidth < (int)(size.Width + 20)) dg.RowHeadersWidth = (int)(size.Width + 20);
// Use default system text brush
Brush b = SystemBrushes.ControlText;
// Draw row number
e.Graphics.DrawString(rowNumber, dg.Font, b, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + ((e.RowBounds.Height - size.Height) / 2));
}