Results 1 to 5 of 5

Thread: Change slidder bar color.

  1. #1
    Guest

    Post

    I have an app that has a slidder bar in it. I have everything design in graphics or a color of some sort. And this darn slidder bar is still using my system colors, so it makes my program look cheezy. I want to be able to change the color to the slidder bar. Any ideas? It's NOT a scrollbar as I have tried that function to change the color, but nothing came of it.

    Any ideas?


    ------------------
    John T. Mieske
    Star Trek LCARS programmer

    Knight Vision Enterprises
    [email protected]

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    well!!!! you could make a slider invisible and a grahpic and then ya know make a scalewidth = the the max value of the slider then use a little coding to move a grahpic across a line...!
    Hope I helped?

    ------------------
    DiGiTaIErRoR

  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    This will change the Main Color of the ScrollBar(s)..

    In a Module..
    Code:
    Option Explicit
    
    Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
    
    Public Const GWL_WNDPROC = (-4)
    Private Const WM_CTLCOLORSCROLLBAR = &H137
    
    Public lPrevWnd As Long
    
    Public Function SubWndProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
        Dim lBrush As Long
        If Msg = WM_CTLCOLORSCROLLBAR Then
            'Change the ScrollBar Color
            lBrush = CreateSolidBrush(vbBlue)
            SubWndProc = lBrush
            Exit Function
        End If
        SubWndProc = CallWindowProc(lPrevWnd, hwnd, Msg, wParam, ByVal lParam)
    End Function
    In the Form..
    Code:
    Private Sub Form_Load()
        lPrevWnd = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf SubWndProc)
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        Call SetWindowLong(hwnd, GWL_WNDPROC, lPrevWnd)
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


  4. #4
    Guest

    Post

    Hey Aaron, This doesn't work with a Slidder Bar. I tried (Unless I did it wrong). Any other ideas? Thanks for the help though.

    Hey DiGiTaIErRoR,
    I thought about that.. but wasn't sure if the scale would work or not. Have you tried it? If so, can you post me an example? It would have to have code to drag that gif up and down correct? got an example of how to do that?

    Knight


    [This message has been edited by Knight_Vision (edited 01-26-2000).]

  5. #5
    Guest

    Post

    Hey Aaron or anyone else who might know.. This code that was supplied by Aaron didn't work. Any other suggestions ? Or am I doing it wrong?

    Knight

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