Is there an api to get the brush handle of the system pattern brush used on scroll bars? I'm drawing my own control, and I would like to use whatever the system is using for this pattern. I think the color is COLOR_SCROLLBAR, but doing a get GetSysColorBrush with that color returns the handle to a solid brush.
I don't see any problem, the following code fills rectangle using brush that represents scrollbar color:
.elseif eax==WM_PAINT
invoke BeginPaint, hWin, ADDR ps
invoke GetSysColorBrush, COLOR_SCROLLBAR
mov br, eax
invoke FillRect, ps.hdc, ADDR rc, br
invoke EndPaint, hWin, ADDR ps
There is no special pattern regarding regular scrollbar, only solid color & moving shapes. If you mean windows themes, you cannot get their brushes...
Yep, that's exactly what I did, and I got solid gray. I want the pattern that windows uses when drawing a scrollbar.
I'm not sure what you mean, but maybe this is it...
.data
rc RECT <10,10,100,100>
br dd 0
pattern dd 4 dup (0)
...
.code
...
.if eax==WM_INITDIALOG
invoke GetSysColor, COLOR_SCROLLBAR
shl eax, 8 ;
bswap eax ; correction for bmp to match inside-out order ... opcode requires .486
mov ecx, 0ffffffh
mov [pattern+ 0], ecx
mov [pattern+ 4], eax
mov [pattern+ 8], eax
mov [pattern+12], ecx
invoke CreateBitmap, 2, 2, 1, 32, ADDR pattern
invoke CreatePatternBrush, eax
mov br, eax
.elseif eax==WM_PAINT
invoke BeginPaint, hWin, ADDR ps
invoke FillRect, ps.hdc, ADDR rc, br
invoke EndPaint, hWin, ADDR ps
If ramguru's solution doesn't work for you, have a look at DrawFrameControl and maybe DrawThemeBackground (if you're targeting XP).
Cheers,
Zooba :U
Ok, thanks guys. Since windows gives you the brush for everything else with a simple api call, I just thought there would be an api to get this brush handle that I just couldn't find.