public class DataGridRow : DataGrid
{
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
try
{
if(this.DataSource!=null)
{
int yDelta;
System.Drawing .Rectangle cell=this.GetCellBounds(0,0);
int y=cell.Top +2;
e.Graphics.DrawString("", this.Font, new SolidBrush(Color.Black), 8, y-18); //
if(this.VisibleRowCount >0)//只在有记录集时在表格中显示序号
{
CurrencyManager cm;
cm = (CurrencyManager) this.BindingContext[this.DataSource, this.DataMember];
if(cm.Count >0)
{
int nRow=-1;
y=41; //为第一行默认高度
while(nRow<0)
{
nRow=this.HitTest (8,y).Row ;