listview控件的显示问题,总显示不完名字.郁闷
每个item显示不管多长总是显示不完整,总是这样"文件..."或者"M...",有什么办法吗?listview的四种显示方式我都试过了.我是从char属性的SQL数据库中读取的第二个问题:
从数据库中读取数据放入text框中,有些一句显示半截,后半截在下一行显示,为什么这样啊?
每个item显示不管多长总是显示不完整,总是这样"文件..."或者"M...",有什么办法吗?listview的四种显示方式我都试过了.我是从char属性的SQL数据库中读取的第二个问题:
从数据库中读取数据放入text框中,有些一句显示半截,后半截在下一行显示,为什么这样啊?
Private Const LVM_FIRST As Long = &H1000
Private Const LVM_SETCOLUMNWIDTH As Long = LVM_FIRST + 30
Public Enum LVSCW_Styles
LVSCW_AUTOSIZE = -1
LVSCW_AUTOSIZE_USEHEADER = -2
End EnumPublic Sub LVSetAllColWidths(lv As ListView, ByVal Style As LVSCW_Styles)
Dim ColumnIndex As Long
'--- loop through all of the columns in the listview and size each
With lv
For ColumnIndex = 1 To .ColumnHeaders.Count
LVSetColWidth lv, ColumnIndex, Style
Next ColumnIndex
End With
End SubPublic Sub LVSetColWidth(lv As ListView, ByVal ColumnIndex As Long, ByVal Style As LVSCW_Styles)
'------------------------------------------------------------------------------
'--- If you include the header in the sizing then the last column will
'--- automatically size to fill the remaining listview width.
'------------------------------------------------------------------------------
With lv
' verify that the listview is in report view and that the column exists
If .View = lvwReport Then
If ColumnIndex >= 1 And ColumnIndex <= .ColumnHeaders.Count Then
Call SendMessage(.hWnd, LVM_SETCOLUMNWIDTH, ColumnIndex - 1, ByVal Style)
End If
End If
End With
End Sub窗口
Private Sub Command3_Click()
Call LVSetAllColWidths(ListView1, LVSCW_AUTOSIZE_USEHEADER)
End Sub
你的text的multiline属性设置为false不允许多行
但第二个问题,不行啊,我本来就是多行啊,
从数据库中读取数据放入text框中,有些一句显示半截,后半截在下一行显示,为什么这样啊?你本身就显示多行,但你要确定显示数据中间是否有不可见字符,比如空格。