自动编号

来源:互联网 发布:苏州市网络拍卖存量房 编辑:程序博客网 时间:2024/05/20 00:36

     private void dataGridView1_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
        {
            int customersTypeID = getCustomerID();
            e.Row.Cells["编号"].Value = customersTypeID;
        }

 using (SolidBrush b = new SolidBrush(dataGridView1.RowHeadersDefaultCellStyle.ForeColor))
            {
                e.Graphics.DrawString(e.RowIndex.ToString(System.Globalization.CultureInfo.CurrentUICulture), e.InheritedRowStyle.Font, b, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 4);
            }

原创粉丝点击