private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { SolidBrush brushOne = new SolidBrush(Color.Red); e.Graphics.DrawString(Convert.ToString(e.RowIndex + 1, System.Globalization.CultureInfo.CurrentUICulture), e.InheritedRowStyle.Font, brushOne, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 4); }
给Winform中的datagridview添加行号
最新推荐文章于 2025-08-09 15:40:03 发布
本文介绍如何在DataGridView控件中通过自定义RowPostPaint事件绘制行索引,采用C#编程实现,具体步骤包括创建事件处理方法、设置画笔颜色和字体、在指定位置绘制行号。
1822

被折叠的 条评论
为什么被折叠?



