private void dataGridOrder_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
int row =1;  
int y = 0;
                            //dS_GoodsOrder是dataSet
int count =this.dS_GoodsOrder.Tables[0].Rows.Count; 

while( row <= count)  

//get & draw the header text... 
 
string text = string.Format("  {0}", row);
                                     //dataGridOrder是dataGrid
y = this.dataGridOrder.GetCellBounds(row - 1, 0).Y + 2;
 
e.Graphics.DrawString(text,this.dataGridOrder.Font, new SolidBrush(Color.Black), 4, y); 

row ++;  
}  }