VB怎么设置Listbox的行间距
'窗体代码
Dim i As Integer
Dim j, k As Integer
Private Sub Command1_Click()
'返回 listbox高度?
' ii = SendMessage((List1.hwnd), LB_GETITEMHEIGHT, 0, &O0)
'在原高度中增加一个值
i = i + 5
‘’Debug.Print "i", i
'设置高度
k = SendMessage((List1.hwnd), LB_SETITEMHEIGHT,0, ByVal i)
'这中变量代号一定用“i”?原因不明
k = SendMessage((List1.hwnd), WM_SETREDRAW, True, 0&)
‘Debug.Print "k", k
End Sub
Private Sub Form_Load()
For j = 1 To 5
'在list1加入几行文字
List1.AddItem "演示" + Format(j)
Next
End Sub
‘模块/Module1 代码
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_USER = &H400
'Public Const LB_GETITEMHEIGHT = (WM_USER + 34)
Public Const LB_SETITEMHEIGHT = &H1A0
vba listbox控件详解Public Const WM_SETREDRAW = &HB
窗体上插入一个列表框(listbox),一个命令按钮(Command1),渐次单击命令按钮看逐步调整列表框内行距变化情况。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论