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显示字符长度,数据放在单元格上时显示全部数据

    


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM