Results 1 to 3 of 3

Thread: scroll bar

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    5

    Question

    Does any one know how to add a horizontal scroll bar in a list box, so you will be able to see a long line of text in the lit box? Thanks.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Take a look at this:
    Code:
    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 
    
    Private Sub Command1_Click() 
    Dim s As String 
    Static x As Long 
    s = InputBox("Please enter any text", "List scroll", _ 
    "this is a simple scrollbar sample for demonstration purposes") 
    List1.AddItem s 
    If x < TextWidth(s & " ") Then 
    x = TextWidth(s & " ") 
    If ScaleMode = vbTwips Then _ 
    x = x / Screen.TwipsPerPixelX ' if twips change to pixels 
    SendMessageByNum List1.hwnd, LB_SETHORIZONTALEXTENT, x, 0 
    End If 
    End Sub
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    5

    Smile

    Thanks. You've been a great help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width