在加載了幾萬條記錄的WIN FROM中DATAGRID在左邊顯示記錄號的問題
以下為在網上查找到的代碼,可以顯示行號,但當記錄數量比較多,如幾萬條記錄時,則需要時間較長,如何優化這個問題? 
 private         void         dataGrid1_Paint(object         sender,         System.Windows.Forms.PaintEventArgs         e)          
 {                      
 	int         row         =1;                      
 	int         y         =         0;          
 	if(this.currentDataSet         !=         null)          
 	{          
 		int         count         =this.currentDataSet.Tables[0].Rows.Count;                            
 		while(         row          <=         count)                      
 		{                
 			//get         &         draw         the         header         text...                                  
 			string         text         =         string.Format( "         {0} ",         row); 
 			y         =         this.dataGrid1.GetCellBounds(row         -         1,         0).Y         +         2;                   
 			e.Graphics.DrawString(text,this.dataGrid1.Font,         new         SolidBrush(Color.Black),2,y);             
 			row         ++;                      
 		}          
 	}                
 }
------解决方案--------------------用虚表,你的问题我也遇到过, 
 我最多显示5万条数据在表格里,不用10秒就可以反映出来 
 但显示不全部装载,只装载看得的那一部分 
 当客户拉动滚动条时再显示他想看的东西, 
 当然DataGrid是不支持的,我用提第三方控件来实现的 
 Farpoint spread 
 这个解决办法也是在这个控件公司的技术论坛上看到的:)