|
-
Apr 16th, 2005, 07:55 PM
#1
Thread Starter
Fanatic Member
Colouring Bars
ok Robert it is in detail
I have seen in various applications that Scroll bars are of different fascinating colours and of attractive styles as well.
what i want to ask is that how can we change colour of VB6 horizontal/vertical scroll bars .
Bundle of Thx.
-
Apr 16th, 2005, 08:22 PM
#2
Frenzied Member
Re: Colouring Bars
 Originally Posted by vbPoet
ok Robert it is in detail
I have seen in various applications that Scroll bars are of different fascinating colours and of attractive styles as well.
what i want to ask is that how can we change colour of VB6 horizontal/vertical scroll bars .
Bundle of Thx.
I have seen this long ago
VB Code:
'In a form
Option Explicit
Private Sub Form_Load()
Call Hook(Me.hWnd)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call Unhook(Me.hWnd)
End Sub
'In a standard module
Option Explicit
Private 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 DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) _
As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Const GWL_WNDPROC = (-4)
Private Const WM_CTLCOLORSCROLLBAR = &H137
Private mPrevProc As Long
Public Sub Hook(hWnd As Long)
mPrevProc = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WndProc)
End Sub
Public Sub Unhook(hWnd As Long)
Call SetWindowLong(hWnd, GWL_WNDPROC, mPrevProc)
mPrevProc = 0&
End Sub
Public Function WndProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
On Error Resume Next
Static hBrush As Long
If uMsg = WM_CTLCOLORSCROLLBAR Then
If hBrush = 0 Then hBrush = CreateSolidBrush(vbRed) 'For a red background
WndProc = hBrush
Exit Function
End If
'Call DeleteObject(hBrush)
If mPrevProc Then
WndProc = CallWindowProc(mPrevProc, hWnd, uMsg, wParam, lParam)
Else
WndProc = DefWindowProc(hWnd, uMsg, wParam, lParam)
End If
End Function
-
Apr 16th, 2005, 08:30 PM
#3
Thread Starter
Fanatic Member
Re: Colouring Bars
it helped...
and further i will try it get required results
but as u have written in your signature don't say thanks so i won't
but tell me How To RATE u ....
-
Apr 16th, 2005, 08:34 PM
#4
Frenzied Member
Re: Colouring Bars
 Originally Posted by vbPoet
it helped...
and further i will try it get required results
but as u have written in your signature don't say thanks so i won't
but tell me How To RATE u .... 
Hey man... under my avatar... Click on Rate this post
well. i think it should be how we rate ppl...
-
Apr 18th, 2005, 08:25 PM
#5
Thread Starter
Fanatic Member
Re: Colouring Bars
O guy
it is not working as xpected ...
becuase i just wanted to colour scroll bar as red or yellow ...!!
-
Feb 5th, 2010, 05:20 AM
#6
Member
Re: Colouring Bars
hi guys, its working fine for me. but i need a small change in this. i just want to change the button color of scrollbar as scrollbar back color. is it possibile?
-
Feb 5th, 2010, 05:29 AM
#7
Re: Colouring Bars
This is an old thread.... ie. about 5 years old....
Create your own thread...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
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
|