DataGridView数据过长显示不全解决办法

 1       public void DataViewShow(GridView GV, int showLenth)
 2         {
 3             GridViewRow currentRow;
 4             for (int i = 0; i < GV.Rows.Count; i++)
 5             {
 6                 currentRow = GV.Rows[i];
 7                 for (int j = 0; j < GV.Columns.Count; j++)
 8                 {
 9                     currentRow.Cells[j].ToolTip = currentRow.Cells[j].Text;
10                     TableCell currentColl = currentRow.Cells[j];
11                     if ((currentColl.Text).Length > showLenth)
12                     {
13                         currentColl.Text = (currentColl.Text).Substring(0, showLenth) + "...";
14                     }
15                 }
16             }
17         }

dataGridview 数据太长无法完全显示,可调用一下方法优化

该方法指定dataGridview显示字符长度,数据放在单元格上时显示全部数据

    

智者乐山山如画, 仁者乐水水无涯。 从从容容一杯酒, 平平淡淡一杯茶。
原文地址:https://www.cnblogs.com/bingxueme/p/2496251.html