如何让LISTVIEW一条信息多行显示   
急急急急急急急急急急急急急急急急急急急

解决方案 »

  1.   

    多行显示???
    下面可能对你有用 
    View 属性(ListView 控件)
          返回或设置 ListView 控件中 ListItem 对象的外观。语法object.View [= value]View 属性的语法包含下面部分:部分 描述 
    object 对象表达式,其值是 ListView 控件。 
    value 指定控件外观的整数或常数,如“设置值”中所描述。 
    设置值value 的设置值为:常数 值 描述 
    lvwIcon 0 (缺省)图标。每个 ListItem 对象由整幅(标准)的图标和文本标签代表。 
    lvwSmallIcon 1 小图标。每个 ListItem 对象由小图标及其右侧的文本标签代表。项目水平排列。 
    lvwList 2 列表。每个 ListItem 对象由小图标及其右侧的文本标签代表。ListItem 对象及其相关的信息在列中垂直排列。 
    lvwReport 3 报表。每个 ListItem 对象显示为小图标和文本标签。可在子项目中提供关于每个 ListItem 对象的附加信息。图标、文本标签和信息显示在列中,其中最左侧一列包含小图标和文本标签。附加列显示每个项目的子项目的文本。 
    说明只有在图标视图中才可使用 LabelWrap 属性指定在显示 ListItem 对象的标签时是否可以换行。在报表视图中,可通过设置 HideColumnHeaders 属性为 True 来隐藏列标头。也可使用 ColumnClick 事件和 Sorted、SortOrder、SortKey 属性实现当用户单击列标头时对 ListItem 对象或子项目排序的目的。还可通过拖动列标头的右边框到适当的位置来变更列的宽度。
      

  2.   

    帮我看看这个:
    private sub form_load()
        Dim ColmX  As ColumnHeader
        Dim LitmX As ListItem
        ListView1.ListItems.Clear
        
            Set ColmX =ListView1.ColumnHeaders.Add(1, "题号")
            ColmX.Width = 1700
            ColmX.Text =  "题号"
            Set ColmX =ListView1.ColumnHeaders.Add(2, "章节")
            ColmX.Width = 1700
            ColmX.Text =  "章节"
            Set ColmX =ListView1.ColumnHeaders.Add(3, "内容")
            ColmX.Width = 1700
            ColmX.Text =  "内容"
       
            Set LitmX = ListView1.ListItems.Add(, , 1)
            LitmX.SubItems(1) = "第一章"
            LitmX.SubItems(2) = "内容"end sub
    这个程序,在listview控件中,怎么就显示不了结果呢???
      

  3.   

    Dim NameOfFile As String
    Dim clmX As ColumnHeader
    Dim itmX As ListItem
    Dim Counter As Long
    Dim dname As String
    Dim TempDname As String
    Dim counter2 As Integer
    Dim CurrentDir As StringApp.Title = "ListView Sample"
    'To Simulate a 640 by 480 screen.
    Me.Width = 640 * Screen.TwipsPerPixelX
    Me.Height = 480 * Screen.TwipsPerPixelY
    Me.Left = (Screen.Width - Me.Width) / 2
    Me.Top = (Screen.Height - Me.Height) / 2
    Combo1.ListIndex = 0
    Combo2.ListIndex = 0' Create an object variable for the ColumnHeader object.
    ' Add ColumnHeaders.  The width of the columns is the width
    ' of the control divided by the number of ColumnHeader objects.
    ListView1.ColumnHeaders.Add , , "Name", ListView1.Width / 3
    Set clmX = ListView1.ColumnHeaders.Add(, , "Size", ListView1.Width / 3)
    Set clmX = ListView1.ColumnHeaders.Add(, , "Date", ListView1.Width / 3)
        
    ListView1.BorderStyle = ccFixedSingle ' Set BorderStyle property.
        
    ' To use ImageList controls with the ListView control, you must
    ' associate a particular ImageList control with the Icons and
    ' Icons were previously Added to list' SmallIcons properties.
    ListView1.Icons = ImageList1
    ListView1.SmallIcons = ImageList2'Start Off With Current Drive and directory
    ChDrive Drive1.Drive
    Dir1.Path = CurDir'Add BackSlash if Necessary
    'If Right(CurrentDir, 1) <> "\" Then CurrentDir = CurrentDir & "\"
    'Dir1.Path = CurrentDir
    'Dir1.Path = Drive1.Drive'NameOfFile = Dir$(CurrentDir & "*.*", vbDirectory)
    Dim Fname As String'If we are in a subdirectory then do the following
    If Right(Dir1.Path, 1) <> "\" Then
        CurrentDir = Dir1.Path & "\"
        dname = ".."
        Set itmX = ListView1.ListItems.Add(, , dname)
        itmX.SubItems(1) = ""
        itmX.Icon = 3           ' Set an icon from ImageList1.
        itmX.SmallIcon = 3      ' Set an icon from ImageList2.
        itmX.SubItems(2) = ""
    Else
        'If not in a subdirectory then do the following
        CurrentDir = Dir1.Path
    End If'Get the FileNames
    For Counter = 0 To File1.ListCount - 1
        Fname = File1.List(Counter)
        Set itmX = ListView1.ListItems.Add(, , Fname)
        itmX.SubItems(1) = CStr(FileLen(CurrentDir & Fname))
        itmX.Icon = 2           ' Set an icon from ImageList1.
        itmX.SmallIcon = 2      ' Set an icon from ImageList2.
        itmX.SubItems(2) = FileDateTime(CurrentDir & Fname)
    Next Counter'Get the Directory Names
    For Counter = 0 To Dir1.ListCount - 1
        dname = Dir1.List(Counter)
        For counter2 = Len(dname) To 1 Step -1
            If Mid$(dname, counter2, 1) = "\" Then
                TempDname = Right(dname, Len(dname) - counter2)
                Exit For
            End If
        Next counter2
        Set itmX = ListView1.ListItems.Add(, , TempDname)
        itmX.SubItems(1) = ""
        itmX.Icon = 1           ' Set an icon from ImageList1.
        itmX.SmallIcon = 1      ' Set an icon from ImageList2.
        itmX.SubItems(2) = FileDateTime(dname)
    Next Counter
    ListView1.View = lvwIcon
    ListView1.Arrange = 0 'lvwNoArrange
    ListView1.LabelWrap = False
    ListView1.Sorted = TrueForm1.Caption = "ListView Sample - " & Dir1.Path
    End Sub