|
-
Mar 4th, 2002, 08:49 AM
#1
Thread Starter
New Member
help with scrollbars, please help!!!
Hey out there!!!!
need help with scroolbars, i want to change the color, of a scrollbar without changin' all of the system colors, if anyone knows how or knows a control that i may use please tell me, i'll apreciate it.
thanx.
[email protected]
k-Pierrothsky, 
-
Mar 4th, 2002, 09:01 AM
#2
Frenzied Member
What you need to do is subclass the form that the scrollbar is on and look for the message WM_CTLCOLORSCROLLBAR.
When you get that message you create a LOGBRUSH and return it's handle from the window proc and the scrollbar control will be drawn with it.
I have coded this into the ApiWindow.ControlColour part of the EventVB.dll release which is due to go public on Friday - can you wait that long? If not send me a private message with your email and I'll send you the dll...
-
Mar 4th, 2002, 10:28 AM
#3
Frenzied Member
Right - the updated EventVB.dll is available to download at this page
To use it to make your scrollbars blue (for example):
Code:
Option Explicit
Dim WithEvents vbLink As EventVB.APIFunctions
Dim WithEvents vbWnd As EventVB.ApiWindow
Private Sub Form_Load()
Set vbLink = New APIFunctions
Set vbWnd = New ApiWindow
vbWnd.hWnd = Me.hWnd
vbLink.SubclassedWindows.Add vbWnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
vbLink.SubclassedWindows.Remove 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)
Dim colThis As ApiColour
Set colThis = New ApiColour
With colThis
.Blue = 255
.Green = 0
.Red = 0
End With
If ControlType = Control_Scrollbar Then
Set ColourBrush.Colour = colThis
End If
End Sub
For a more special effect, set the ColourBrush.Bitmap value to a 16x16 image which will be used (tiled) to paint the scrollbar background.
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
|