如何修改LISTVIEW控件所显示的每行数据的高度,也就是
       Dim itmx As ListItem       Set itmx = lsv.ListItems.Add(, , " " & mrc(1))
       itmx.Height = itmx.Height + 10   该条语句能否实现,我试过了但是没有效果!!!

解决方案 »

  1.   

    你直接设置字体就可以了,但是告诉你LISTVIEW的格的高度必须是一样的,小心你显示不下呀!
    实现字体变化,你在设
    ListView1->Canvas->Font->Size = 12;
    ListView1->Canvas->Font->Name = "宋体";
    随你的便了!
      

  2.   

    终于找到了Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Const WM_USER = &H400
    Const LB_GETITEMHEIGHT = (WM_USER + 34)
    Const LB_SETITEMHEIGHT = &H1A0
    Const WM_SETREDRAW = &HB'Height is returned in terms of pixels
    Function ListBox_getItemHeight(st As Control) As Integer
        'Retrieve the height of the listbox
        'item
        ListBox_getItemHeight = SendMessage((st.hwnd), LB_GETITEMHEIGHT, 0, &O0)
    End Function
    'Sets the height of the items of the
    'listbox to a specified one.
    Sub ListBox_setRowHeight(st As Control, Height As Long)
        Dim ignore As Integer
        ignore = SendMessage((st.hwnd), LB_SETITEMHEIGHT, 0, _
            ByVal Height)
        'Refresh the listbox
        ignore = SendMessage((st.hwnd), WM_SETREDRAW, True, 0&)
    End SubPrivate Sub Command1_Click()
    Dim i As Long
    i = ListBox_getItemHeight(list1)
    i = i + 4
    ListBox_setRowHeight list1, i
    End Sub
    Private Sub Form_Load()
    Dim i
    For i = 1 To 5
        list1.AddItem "演示" + Format(i)
    Next
    End Sub