Bitmap with a scroll bar

This is a discussion on Bitmap with a scroll bar within the Windows Programming forums, part of the Platform Specific Boards category; Hi I have a problem I can't think through. If there are one bitmap and one scroll bar, how can ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    173

    Unhappy 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 , Thank you!!
    Don't laugh at me,I am just a SuperNewbie.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,853
    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
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitmap scroll issues
    By Gerread in forum Windows Programming
    Replies: 4
    Last Post: 05-14-2007, 05:18 AM
  2. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 12:32 PM
  3. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  4. Problem with Scroll Bar
    By Garfield in forum Windows Programming
    Replies: 8
    Last Post: 11-05-2001, 04:34 AM
  5. Problem with Scroll Bar
    By Garfield in forum Windows Programming
    Replies: 3
    Last Post: 11-01-2001, 01:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21