1,additem增加一个字符串到listbox,结果字符串太长,listbox显示不下,但是
却没有左右滚动条出来,怎样才能让他显示不下以后有左右滚动条啊?
2,当items足够多时会自动生成上下滚动条,我想再Additem增加一个字符串以后
显示自动翻滚到最后一行,怎么实现啊?我只知道text里面翻滚是
text.selcount=len(text.text),list里面怎么实现啊?
谢谢各位了
却没有左右滚动条出来,怎样才能让他显示不下以后有左右滚动条啊?
2,当items足够多时会自动生成上下滚动条,我想再Additem增加一个字符串以后
显示自动翻滚到最后一行,怎么实现啊?我只知道text里面翻滚是
text.selcount=len(text.text),list里面怎么实现啊?
谢谢各位了
Private Sub Command2_Click()
Dim i As Integer
For i = 0 To 5
List1.AddItem "Item" & CStr(i)
Next i
List1.SetFocus
List1.ListIndex = 5
End Sub
Private Declare Function SendMessageByNum Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const LB_SETHORIZONTALEXTENT = &H194 If longth < TextWidth(lst_Fields.list(lst_Fields.ListIndex) & " ") Then
longth = TextWidth(lst_Fields.list(lst_Fields.ListIndex) & " ")
If ScaleMode = vbTwips Then
longth = longth / Screen.TwipsPerPixelX
SendMessageByNum lst_select_field.hwnd, LB_SETHORIZONTALEXTENT, longth, 0
End If
End If
If lst_Fields.ListIndex <> -1 Then
lst_select_field.AddItem lst_Fields.list(lst_Fields.ListIndex)
If longth < TextWidth(lst_Fields.list(lst_Fields.ListIndex) & " ") Then
longth = TextWidth(lst_Fields.list(lst_Fields.ListIndex) & " ")
If ScaleMode = vbTwips Then
longth = longth / Screen.TwipsPerPixelX
SendMessageByNum lst_select_field.hwnd, LB_SETHORIZONTALEXTENT, longth, 0
End If
End If
End If
Public Const LB_SETHORIZONTALEXTENT = &H194'设置水平滚动条,宽为400 pixs
SendMessage lst.hwnd, LB_SETHORIZONTALEXTENT, 400, ByVal 0&