Results 1 to 3 of 3

Thread: BMP Button??

  1. #1

    Thread Starter
    Frenzied Member Technocrat's Avatar
    Join Date
    Jan 2000
    Location
    I live in the 1s and 0s of everyones data streams
    Posts
    1,024
    Well if you have the button set as a child, then what you could do is catch the WM_LBUTTONDOWN for when the left mouse button is clicked down and WM_LBUTTONUP for when the button is released. So it would be something like this:

    PHP Code:
    case WM_LBUTTONDOWN   //Left Mouse Button Down
    {
      if(
    hwnd == ThehwndOfYourButton)
      {
        
    BitBlt(hdcofbutton00btnwidthbtnheighthdcofBitmap00SRCCOPY);
        break;
      }
      default:
          break;
    }


    case 
    WM_LBUTTONUP   //Left Mouse Button Up
    {
      if(
    hwnd == ThehwndOfYourButton)
      {
        
    BitBlt(hdcofbutton00btnwidthbtnheighthdcofBitmap00SRCCOPY);
        break;
      }
      default:
          break;

    You will have to either make your bitmap and DCs global or rewrite your hdc and SelectObject code in each case, because you will not be resending the messages to WM_PAINT.

    If you dont know what the hdc of the button is you can use

    PHP Code:
    HDC hdc;
    hdc GetDC(hwndOfTheButton); 
    MSVS 6, .NET & .NET 2003 Pro
    I HATE MSDN with .NET & .NET 2003!!!

    Check out my sites:
    http://www.filthyhands.com
    http://www.techno-coding.com


  2. #2
    Hyperactive Member AAG's Avatar
    Join Date
    Aug 2000
    Location
    United States
    Posts
    411

    Exclamation didn't work

    first you forgot the : after each case. second it doesn't seem to catch when the leftmousdown or mouseup. i even tried just making it popup a msgbox when it was clicked rather than setting the pic. that didn't work either. my button is WS_CHILD. it doesn't work. i got the picture to be painted on my button but like i said it won't catch the mouse events. what could be wrong ? if u would like i'll send u the code. but i'm not a beginner. well i am to bitblt. but not to c++ win32.

  3. #3

    Thread Starter
    Frenzied Member Technocrat's Avatar
    Join Date
    Jan 2000
    Location
    I live in the 1s and 0s of everyones data streams
    Posts
    1,024
    Yeah I wrote that hole thing from memory so I have no doubt that I would forget something like the :. That would be fine with me. [email protected]
    MSVS 6, .NET & .NET 2003 Pro
    I HATE MSDN with .NET & .NET 2003!!!

    Check out my sites:
    http://www.filthyhands.com
    http://www.techno-coding.com


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width