前提是不能设置GridView的列宽(可以设置表头的宽度代替列宽GridView强制不换行_qt)

把下面代码加到Me.objGv.DataBind()下面

 

GridView强制不换行_qt_02'GridView表头强制不换行
GridView强制不换行_qt_02objGv.HeaderRow.Style.Add("word-break", "keep-all")
GridView强制不换行_qt_02'GridView内容强制不换行
GridView强制不换行_qt_02For i As Integer = 0 To objGv.Rows.Count - 1
GridView强制不换行_qt_02    For j As Integer = 0 To objGv.Rows(i).Cells.Count - 1
GridView强制不换行_qt_02        objGv.Rows(i).Cells(j).Wrap = False
GridView强制不换行_qt_02        objGv.Rows(i).Cells(j).Style.Add("word-break", "keep-all")
GridView强制不换行_qt_02    Next
GridView强制不换行_qt_02Next