What system color is the background color of a Scrollbar? On an application there are many scrollbars (grids, textboxes. lists. etc). And one lonely hand crafted custom control. (let's call it myVScroll). I have made the buttons, and thumb of myVScroll look like the 'real thing'. But depending on what the individual PC settings are, the shaft (is that what it is?) of the native scrollbars are slightly different colors. To maximize the eye candy, I need the shaft color of myVScroll (myVScroll.Backcolor) to be the same color as the native scrollbars shaft color. What is that color?
This is with myVScroll backcolor set to &HF0F0F0. This seems to be a close match to the generic MSHFlexgrid horizontal scrollbar. Thanks for the pointer dilettante, but in this case (and on this PC), vbWindowBackground is too white.
Now, set the app to run in Reduced color mode, I see this
Close, but not first prize. If I edit the bottom right corner of the picture, I see this
Notice the texture of the horizontal scrollbar. How do they do that?
Bob.
This picture shows what remains to be done. This is the bottom right corner of an MSHFlexgrid set to show 'classic' scrollbars. Again, MyVScrollbar is the vertical one. You can clearly see the solid color of the body of MyVScrollbar vs the 'brushed' body of the Microsoft horizontal scrollbar.
The 'patternbrush' tip from VBClassic04 is the breakthrough I needed. Some heavy duty code in this project (for a lightweight like me). In fact, I might just use the whole thing and trash MyVScrollbar if I can get the 'themed' mode to work. For me all it shows is the classic look, nothing like Win10 scrollbar to be seen (yes, I'm running it as test.exe and the manifest is in the same folder).
External manifests on Win7 and above do not typically work. You should consider embedding the manifest into your compiled exe. Here is a link to a project of mine. You do not need to use the project to embed a manifest, but in that link (post #3) describes how to manually embed manifests into a VB resource file which gets compiled into your exe.
Manifests do not automatically theme user-created custom controls. If you are creating your own control, you need to apply themes yourself via code, using the theme APIs. Manifests theme Windows controls (window classes).
To see if your manifest is being used/applied, simply add a typical intrinsic control (button, textbox, checkbox, etc) on your form and recompile. If properly manifested, the control should be themed.
Insomnia is just a byproduct of, "It can't be done"
Hmmm, that intrinsic VScrollBar is a tricky booger. I thought I'd play around with sub-classing it and see what I could get accomplished. It has the standard WM_PAINT and WM_ERASEBKGND messages as would be expected.
However, if you try to repaint it (FillRect with CreateSolidBrush) on WM_ERASEBKGND, nothing much happens.
If you try to repaint it on WM_PAINT, that re-paints it, however...
If you just exit the callback function (not letting the chain continue), it gets caught in a loop whereby it just keeps calling WM_PAINT.
If you let the chain continue, our re-paint gets over-written.
Apparently, further downstream, there's something that tells the VScrollBar to keep calling WM_PAINT until it gets painted the way it wants.
That makes some sense since there's the up-button, down-button, scroll-button, as well as the actual exposed scroll background. And that doesn't even cover the 3D effects on those buttons.
Therefore, if sticking with the intrinsic VScrollBar, I'm somewhat stumped on how to alter its colors with sub-classing.
Best Regards,
Elroy
EDIT1: Also, I checked to see if that thing has children, and it doesn't.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
For me, it'd be nice if we just had total control over the VScrollBar and HScrollBar, with both defaulting to the way the VB6 intrinsic controls look (or possibly themed).
But I'm not thinking that's going to happen without a complete roll-your-own approach.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Another small step for mankind, a giant step for me. Without checking the release date of the test project from VBClassic04, it is before Win 7. Some tweaking of the project, and 'themes' came to life (and thanks to LaVolpe) no manifest necessary.
Now, before I can flag this thread as resolved, I would like some assistance with a more robust fix than my simple hack to get themes to work.
Here's my analysis of why the project doesn't automatically theme (pseudo code below).
Code:
Private Sub pvOnPaint(ByVal lhDC As Long)
Case m_eStyle = [sClassic] Or (m_eStyle = [sThemed] And m_bIsLuna = False)
' paint classic scrollbar
Case m_eStyle = [sFlat]
' paint flat scrollbar
Case m_eStyle = [sThemed]
' paint themed scrollbar
Because m_bIsLuna is always False for Win 10, when Themed mode is selected, The Classic case statement code is executed. m_bIsLua is set True/False in the pvCheckEnvironment sub. his is the code that needs some serious work. I don't understand the significance m_bIsLuna at all, any/all assistance is appreciated.
I played with GetThemeSysColor() to retrieve a few related colors. Supposedly requesting the brush just gives a brush of the same color, no patterning.
In any case, just a VScroll and ListBox, not even any manifest, on Win10 I see:
Examining a screenshot, ButtonFace and ThreeDFace are identical and match the ListBox scrollbar color. So no telling which might be correct, or if some other iColorID is the correct one for scrollbars.
Resolved, with thanks to all. I hacked away at the code for an hour or two, then found a newer version at http://www.vbforums.com/showthread.p...on-Design-mode that had all the fixes (and more) that I needed. Again, thanks. Bob.
Hmmm, that intrinsic VScrollBar is a tricky booger. I thought I'd play around with sub-classing it and see what I could get accomplished. It has the standard WM_PAINT and WM_ERASEBKGND messages as would be expected.
The msg of interest here is WM_CTLCOLORSCROLLBAR
The code below paints the scrollbar correctly with no code in the WinProc
Code:
Option Explicit
'reference: SSubTimer6.dll
Implements ISubclass
Private Const WM_CTLCOLORSCROLLBAR = &H137
Private Sub Form_Load()
AttachMessage Me, hwnd, WM_CTLCOLORSCROLLBAR
End Sub
Private Sub Form_Unload(Cancel As Integer)
DetachMessage Me, hwnd, WM_CTLCOLORSCROLLBAR
End Sub
Private Property Let ISubclass_MsgResponse(ByVal RHS As SSubTimer6.EMsgResponse)
'
End Property
Private Property Get ISubclass_MsgResponse() As SSubTimer6.EMsgResponse
'
End Property
Private Function ISubclass_WindowProc(ByVal hwnd As Long, ByVal iMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'
End Function