Thread: Displaying a seperate bitmap for each menu button

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    8

    Question Displaying a seperate bitmap for each menu button

    Ok, I have a menu and when the menu button is pressed I want a bitmap to appear for each bitmap. here is what i have s far:
    PHP Code:
    switch(LOWORD(wparam)) // The LOWORD(wparam) will equal the "identifier" of
                
    {                       // of whatever was selected -- These are #defined in 
                                       // resource.h
                                       // **Note:  If using VC++6.0 these are given to you when you "make a resource script"
                                       // So I didn't come up with these names (I could change 'em) but I'm using the defaults

                    
                    
    case ID_QUIT// If they select "Quit" -- quit the program
                    
                        
    PostQuitMessage(0);
                            break;
                    
                    
    // The user selected "Mars Alpha" under the "Maps" menu
                    
    case ID_MAPS_SOLSYSTEM_MARSALPHA:
    # Here is where i want the bitmap to be displayed
    break; 

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Roughly you need

    Check to see if the button has been pressed
    BN_CLICKED==HIWORD(wParam)
    Load the bmp with LoadImage() or similar
    GetDC() on the button
    GetClientRect() on button
    CreateCompatibleDC()
    CreateCompatibleBitmap()
    Select BPM into HDC
    Colour with fillrect() to avoid edges being diff colour.
    BitBlt() or StretchBlt() BMP to HDC

    Then all you need is to be able to repaint in response to WM_PAINT msg's

    Try a search for more detailed responses.
    "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. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. Need help with Bitmap Display
    By The Brain in forum Windows Programming
    Replies: 7
    Last Post: 03-23-2009, 05:33 AM
  3. displaying a bitmap on a button
    By korbitz in forum Windows Programming
    Replies: 13
    Last Post: 04-01-2004, 05:35 PM
  4. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM