dataGridView怎么在第一行的ID,按添加键后自动加1 dataGridView怎么在第一行的ID,按添加键后自动加1 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果是用sql,在数据库那里设置那一个标记为true #region[事件][行序列号实现] private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if (e.ColumnIndex < 0 && e.RowIndex >= 0) { e.Paint(e.ClipBounds, DataGridViewPaintParts.All); Rectangle indexRect = e.CellBounds; indexRect.Inflate(-2, -2); TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), e.CellStyle.Font, indexRect, e.CellStyle.ForeColor, TextFormatFlags.Right | TextFormatFlags.VerticalCenter); e.Handled = true; } } #endregion看一下这个是不是你要的效果 可是我用的是ACCESS怎么办啊?加急哦!谢谢 对了,还有我是用C#编的~利用dataGridView显示内容了,但在第一行ID希望能按添加键后自动就能加1 winform 中创建存储过程。 如何知道父窗体的名称是谁 SendMessage,VM_GETTEXT引起程序崩溃的问题. (紧急求助)combobox 数据绑定后 出现的怪问题 请看数据类型转换的问题 新手问“未将对象引用设置到对象的实例”问题 如何用反射设置一个对象的枚举属性值 问题很急,解决了就给分,在线=== 如何用最简单的方式来捕获下面这种异常并进行处理? 我的vs自动提示功能没有了! 如何快速给一个数组赋初值? datagridview 中选中多行,如何获取这些选中行里每行第几列的值.
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex < 0 && e.RowIndex >= 0)
{
e.Paint(e.ClipBounds, DataGridViewPaintParts.All);
Rectangle indexRect = e.CellBounds;
indexRect.Inflate(-2, -2);
TextRenderer.DrawText(e.Graphics,
(e.RowIndex + 1).ToString(),
e.CellStyle.Font,
indexRect,
e.CellStyle.ForeColor,
TextFormatFlags.Right | TextFormatFlags.VerticalCenter);
e.Handled = true; }
}
#endregion
看一下这个是不是你要的效果
可是我用的是ACCESS怎么办啊?加急哦!谢谢