private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && e.Value.ToString() != string.Empty)
{
//if (!string.IsNullOrEmpty(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) && this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
//{
#region
int UpRows = 0;//上面相同的行数
int DownRows = 0;//下面相同的行数
int count = 0;//总行数
int cellwidth = e.CellBounds.Width;//列宽
//获取下面的行数
for (int i = e.RowIndex; i < this.dataGridView1.Rows.Count; i++)
{
if (this.dataGridView1.Rows[i].Cells[e.ColumnIndex].Value
C# DataGridView合并单元格
最新推荐文章于 2024-05-14 15:06:39 发布
本文详细介绍了如何在C#中使用DataGridView控件进行数据绑定,并展示了如何合并单元格,提升表格展示效果。通过实例代码,读者将掌握在Windows应用程序中操作和定制DataGridView的关键技巧。
摘要由CSDN通过智能技术生成