VB 6.0에서 listbox 가로 스크롤 생성

winsock1.senddata 이부분 밑에는
winsock1.listindex = winsock1.listcount – 1
이렇게 써주시면 스크롤이 자동으로 내려갑니다.^^




—–*추가내용*—–

가로 스크롤 생성

”””””””일반프로시저 에 넣을곳
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
Private Const LB_SETHORIZONTALEXTENT = &H194
Dim LV As String
”””””””여기서부터 폼의 속성으로넣어주세요
Private Sub AddScroll(List As ListBox)
Dim i As Integer, intGreatestLen As Integer, lngGreatestWidth As Long
For i = 0 To List.ListCount – 1


If Len(List.List(i)) > Len(List.List(intGreatestLen)) Then
intGreatestLen = i
End If
Next i
lngGreatestWidth = List.Parent.TextWidth(List.List(intGreatestLen) + Space(1))
‘Space(1)은 문자열의 짤림방지용입니다.
lngGreatestWidth = lngGreatestWidth \ Screen.TwipsPerPixelX
‘스크롤바를 추가한다.
SendMessage List.hwnd, LB_SETHORIZONTALEXTENT, lngGreatestWidth, 0

End Sub
‘그다음 스크롤을 생성하는것..
‘이건 아무데나 해도됩니다.
Private Sub Form_Load()
Call AddScroll(List1)
End Sub
‘저는 폼이 켜질때로 하겠습니다.
‘이렇게 해주시면 길게 된 문자가 쓰여지면 가로스크롤이 생성됩니다.

댓글

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다