Results 1 to 3 of 3

Thread: help with scrollbars, please help!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    Mexico city
    Posts
    1

    Question 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,

  2. #2
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    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...
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  3. #3
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    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.
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

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