1.这段代码是处理过长字符串的主体;
[DataGird]如何截取过长的字符串void ItemDataBound(object sender, DataGridItemEventArgs e)
2.AdjustTextForDisplay(string,int,DataGrid)函数的功能是根据列的宽度,截取过长的字符串;
这里需要注意的是DataGrid的Font和Columns[colIndex].ItemStyle.Width属性必需有赋值。如果没有赋值的话,函数将会采用系统默认的值。如不加处理,函数会出异常。
[DataGird]如何截取过长的字符串string AdjustTextForDisplay(string text, int colIndex, DataGrid grid)

相关文章: