|
-
December 19th, 1999, 05:42 AM
#1
Problems with ListBox!!!
Hello,
my entries in List1 (ListBox) are to long, so they cannot be displayed right. how can I create a horizontal scrollbar or let appear the unvisible part one line down?
Thanks a lot for your help!!!
AScomp
-
December 19th, 1999, 11:15 AM
#2
Re: Problems with ListBox!!!
You can use a picturebox with hidden method .Print - something like Picture1.Print List1.List(Index).
If it looks too complicated - let me know and I'll send you an example - I have it at home already done (met the same problem some day)
Jean Spector
Tech Support Team Leader, CET
[email protected]
(in VB from 11/1999)
-
December 20th, 1999, 05:15 AM
#3
Re: Problems with ListBox!!!
You can use the following code to find out the max-length of your widest item in the listbox and then set a Horizontal scrollbar in the listbox :
Create a new project with a form (FORM1) a listbox (LIST1) and a button (Command1) and paste in the following code :
option Explicit
'
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
'
private Sub Command1_Click()
Dim lMaxLen as Long
Dim lCount as Long
'
for lCount = 0 to List1.ListCount - 1
If TextWidth(List1.List(lCount)) > lMaxLen then
lMaxLen = TextWidth(List1.List(lCount))
End If
next
'
lMaxLen = lMaxLen / Screen.TwipsPerPixelX ' if twips change to pixels
SendMessage List1.hwnd, LB_SETHORIZONTALEXTENT, lMaxLen, 0&
'
End Sub
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|