PDA

Click to See Complete Forum and Search --> : Change slidder bar color.


Jan 24th, 2000, 01:55 AM
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
kvision@gate.net

DiGiTaIErRoR
Jan 24th, 2000, 02:53 AM
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

Aaron Young
Jan 24th, 2000, 03:42 AM
This will change the Main Color of the ScrollBar(s)..

In a Module..

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..

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
aarony@redwingsoftware.com
ajyoung@pressenter.com

Jan 24th, 2000, 04:43 AM
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).]

Jan 25th, 2000, 08:27 PM
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