|
-
Dec 12th, 2002, 08:52 AM
#1
Thread Starter
Lively Member
scrollbar color
some weeks back i found in the forum a thread where someone wanted to have the scrollbar of a treeview in another color. as this was not possible his was gaven the advice to replace the scrollbar of the treeview with a custom scrollbar and change its' color.
well i don't need it for a treeview but anyways i cannot find a scrollbar with a 'color' property. (there are two kinds of scrollbars - the standard one and the FlatScrollBar but neither of them has a color or backcolor property)
any idea?
thx
Geordi: Data... I made that joke seven years ago"
Data: "I know.... I just got it!"
-
Dec 12th, 2002, 08:55 AM
#2
-
Dec 12th, 2002, 09:01 AM
#3
Frenzied Member
When a VB form has a standard scrollbar on it, whenever that scrollbar needs to be redrawn the first thing it does is send a WM_CTLCOLORSCROLLBAR message to the parent form. If you subclass that form you can alter the colour used.
-
Dec 12th, 2002, 09:04 AM
#4
Thread Starter
Lively Member
Originally posted by MerrionComputin
When a VB form has a standard scrollbar on it, whenever that scrollbar needs to be redrawn the first thing it does is send a WM_CTLCOLORSCROLLBAR message to the parent form. If you subclass that form you can alter the colour used.
can you give me an example how?
(or give me an advice where i could find it?)
thx
Geordi: Data... I made that joke seven years ago"
Data: "I know.... I just got it!"
-
Dec 12th, 2002, 09:05 AM
#5
-
Dec 12th, 2002, 09:09 AM
#6
-
Dec 12th, 2002, 09:15 AM
#7
Frenzied Member
Example of purple scrollbars, using the EventVB.dll:
VB Code:
Option Explicit
Dim WithEvents vbLink As EventVB.APIFunctions
Dim WithEvents vbWnd As EventVB.ApiWindow
Dim colScrollbars As EventVB.ApiColour
Private Sub Form_Load()
Set vbLink = New APIFunctions
'\\ Decide what colour to use for the scrollbars
Set colScrollbars = New ApiColour
With colScrollbars
.Red = 100 '\\ Out of 255
.Green = 0
.Blue = 100
End With
Set vbWnd = New ApiWindow
vbWnd.hWnd = Me.hWnd
vbLink.SubclassedWindows.Add vbWnd
End Sub
Private Sub vbWnd_ControlColour(ByVal ControlType As EventVB.StandardControlTypes, ByVal DeviceContext As EventVB.ApiDeviceContext, ByVal ControlWindow As EventVB.ApiWindow, ColourBrush As EventVB.ApiLogBrush)
If ControlType = Control_Scrollbar Then
Set ColourBrush.Colour = colScrollbars
End If
End Sub
Or if you don't want to include a dll, do a search on MSDN for WM_CTLCOLORSCROLLBAR for how it works....
Hope this helps,
Duncan
-
Dec 12th, 2002, 09:26 AM
#8
Thread Starter
Lively Member
thanks MerrionComputin but...
it still doesn't make the whole scrollbar coloured. is it possible or should i stick to the two pictureboxes and a custom made scrollbar?
Geordi: Data... I made that joke seven years ago"
Data: "I know.... I just got it!"
-
Dec 12th, 2002, 10:05 AM
#9
Frenzied Member
There doesn't seem to be a scrollbar forecolor property nor API call equivalent.
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
|