在vb6.0中增加ListBox项高度

时间:2013-12-04 06:43:28

标签: vb6

我尝试在列表框视图中绑定客户名称,但行高之间的项目之间的空间不太宽松。我不知道如何增加项目行高。所以请任何人帮忙。

1 个答案:

答案 0 :(得分:1)

Const LB_SETITEMHEIGHT = &H1A0
Const CB_SETITEMHEIGHT = &H153

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

Sub SetListItemHeight(oCtrl As Control, ByVal lngHeight As Long)
    Dim lngMsg As Long
    If TypeOf oCtrl Is ListBox Then
        lngMsg = LB_SETITEMHEIGHT
    ElseIf TypeOf oCtrl Is ComboBox Then
        lngMsg = CB_SETITEMHEIGHT
    Else
        Exit Sub
    End If
    SendMessage oCtrl.hWnd, lngMsg, 0, Byval CLng(lngHeight And &HFFFF&)
    oCtrl.Refresh
End Sub