-
Bitmap with a scroll bar
Hi
I have a problem I can't think through.
If there are one bitmap and one scroll bar, how can I change the bitmap color by moving the scroll bar.
For example, the scroll bar Max.length = 255.
At the beginning, the scrollbar is on the left and the position = 0, bitmap color is white, as I move the scrollbar the color of the bitmap changes and becomes to black until the scrollbar is on the right side and position = 255. Any one who knows the idea can you please write a sample code. I wish it is clear :p, Thank you!!
-
Well first in most cases
0 == BLACK
255 == WHITE
but
Code:
Find scroll bar pos
Convert to a colour (ie COLORREF Black=RGB(0,0,0); this will be based on the 'scrollpos' ie Current_Colour = RGB(scrollpos,scrollpos,scrollpos);
//You will have a HDC with the client area in it.
Just find the area to paint (GetClientRect() )
Create a brush with the correct colour
use FillRect() to colour it in
call for a paint
Clean up the GDI resources created