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