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

    

posted on 2012-05-11 15:56  絕對零℃  阅读(4842)  评论(3编辑  收藏  举报