CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Jan 2010
    Location
    Philadelphia, Pa
    Posts
    9

    Adding Bitmap To button?

    Hello, I've created a simple MFC Dialog Box in VC++ 2003 (VC++ Version 7). I need to add a bitmap to one of my buttons. It's a "Play" button, and i just need to add a simple bitmap to it. A little thing like adding a button should be easy, but i haven't had the fortune of finding out how. Could some one please explain how to do this, and if possible provide an example. Thank you! I'd really appreciate all input.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Adding Bitmap To button?

    Did you try to use CButton::SetBitmap method?
    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2010
    Location
    Philadelphia, Pa
    Posts
    9

    Re: Adding Bitmap To button?

    Quote Originally Posted by VictorN View Post
    Did you try to use CButton::SetBitmap method?
    Would you please be able to elaborate? I've seen it, but haven't found a good example.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Adding Bitmap To button?

    i just need to add a simple bitmap to it
    Add or put? Add implies having a bitmap along with a text. And the latter unfortunately is not that easy as it looks for the first glance. But if this is the put case, SetBitmap will do the trick alright.

    I've seen it, but haven't found a good example.
    Isn't that from MSDN good enough?
    Code:
    CButton myButton;
    
    // Create a bitmap button.
    myButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_BITMAP, 
       CRect(10,10,60,50), pParentWnd, 1);
    
    // Set the bitmap of the button to be the system check mark bitmap.
    myButton.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(OBM_CHECK)) );
    Best regards,
    Igor

Tags for this Thread

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

Featured