Results 1 to 28 of 28

Thread: Scrollbar

  1. #1

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372

    Scrollbar

    Hey guys,
    how do I go about changing the colour of the scrollbar in a text box?
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  2. #2

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    I also want to change the colour of the menu.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  3. #3
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Re: Scrollbar

    Originally posted by GingerNut
    Hey guys,
    how do I go about changing the colour of the scrollbar in a text box?
    I don't think you can do that...
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    I reckon that should be possible. I don't know the code, but shouldn't setting the forcolor and/or backcolor of the scrollbar chnage its appearence? Afterall, IE does it in response to certain settings in HTML file.

  5. #5
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    I guess you're talking about changing the forecolor of a browser. He's asking how to change it to a TextBox.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  6. #6

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    It's a textbox scrollbar.

    I've been searching all evening and can't find anything.

    I got the menu sorted though.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  7. #7
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    This supposively would work :

    VB Code:
    1. Option Explicit
    2.  
    3. Declare Function CallWindowProc Lib "user32" Alias _
    4.  "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
    5.  ByVal hwnd As Long, ByVal Msg As Long, _
    6.  ByVal wParam As Long, ByVal lParam As Long) As Long
    7.  
    8. Declare Function SetWindowLong Lib "user32" Alias _
    9.  "SetWindowLongA" (ByVal hwnd As Long, _
    10.  ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    11.  
    12. Public Const GWL_WNDPROC = -4
    13. public Const WM_CTLCOLORSCROLLBAR = 311
    14.  
    15. Public Sub Hook()
    16.    lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, _
    17.    AddressOf WindowProc)
    18. End Sub
    19.  
    20. Public Sub Unhook()
    21.    Dim temp As Long
    22.    temp = SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)
    23. End Sub
    24.  
    25. Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, _
    26.                     ByVal wParam As Long, ByVal lParam As Long) As Long
    27.    If uMsg <> WM_CTLCOLORSCROLLBAR Then
    28.       Debug.Print uMsg, hw
    29.       WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)
    30.    End If
    31. End Function
    32.  
    33. Option Explicit
    34.  
    35. Dim lpPrevWndProc As Long
    36. Dim gHW As Long
    37.  
    38. Private Sub Form_Load()
    39.    gHW = Me.hwnd
    40.    Command1.Caption = "Hook"
    41.    Command2.Caption = "Unhook"
    42. End Sub
    43.  
    44. Private Sub Command1_Click()
    45.    Hook
    46.    VScroll1.Refresh
    47. End Sub
    48.  
    49. Private Sub Command2_Click()
    50.    Unhook
    51. End Sub
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  8. #8
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Originally posted by Mc Brain
    I guess you're talking about changing the forecolor of a browser. He's asking how to change it to a TextBox.
    See this HTML page. You can change the forecolor of the scroll bars. Ther are other properties too which can be modified.
    Attached Files Attached Files

  9. #9
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    I know that you can change the colour to it... but if it's an HTM page, you're using a browser
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  10. #10

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    James, I don't suppose you could put that into action for me.
    I'm getting errors here.

    amitabh, I need to change the colour in a vb form not a web page, but thanks anyway.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  11. #11
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    What I meant was that if IE could do it, there was a posibility of doing it through our code also.

  12. #12
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Originally posted by GingerNut
    James, I don't suppose you could put that into action for me.
    I'm getting errors here.

    amitabh, I need to change the colour in a vb form not a web page, but thanks anyway.
    Here you are.
    Attached Files Attached Files
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  13. #13
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Originally posted by amitabh
    What I meant was that if IE could do it, there was a posibility of doing it through our code also.
    Not necesarilly... a Browser and a TextBox are way too different.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  14. #14
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Originally posted by Mc Brain
    Here you are.
    Sorry I missed that one...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  15. #15

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    Didn't do anything.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  16. #16
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    This code should work for NT Os' What are you using?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  17. #17
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Originally posted by Mc Brain
    Not necesarilly... a Browser and a TextBox are way too different.
    But they have scrollbars with similar base class I suppose.

  18. #18
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    For some reason my project is hanging when trying to add this code into other project. Apparently... it doesn't like to be subclassed.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  19. #19
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Originally posted by Mc Brain
    For some reason my project is hanging when trying to add this code into other project. Apparently... it doesn't like to be subclassed.
    Now that you mention it, subclassing is a pian in the arse. I'll see if I can find another example...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  20. #20

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    I'm using ME. (I'm too cheap to buy a decent OP )
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  21. #21
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Can't make it work... I mean, it work alone. But it hangs if I've already subclass the form.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  22. #22

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    I think I'm gonna have to give up on this.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  23. #23
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Anyway... this code is to change a VScrollbar, not a TextBox scrollbar.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  24. #24

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    Right, I've gone through just about every vb site I know of and can't find how to change the scrollbar colour in a textbox, so I'm calling it a night.

    If anyone does manage to find out how it's done, let me know.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  25. #25
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    I have searched many Vb forums, and I can't find any other code that the code I provided earlier...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  26. #26

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    Bummer. Ah well.
    I suppose I could take the scrollbar off and use images to imitate the scrollbar, at least the up and down arrows.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  27. #27
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    What kind of data are you displaying anyways?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  28. #28

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    it's a chat program, so it's just text.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

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