puzzled by adding a bitmap to a button 
Author Message
 puzzled by adding a bitmap to a button


> I have two buttons in my dialog.
> Now I want to add bitmaps to the buttons.
> It seems pretty straight forward.  Just load bitmap and SetBitmaps.
> However, during the test runs, the bitmaps never show up.
> The code is cut from InitDialog function.

>         CBitmap bmpAdd;
>                 ASSERT(bmpAdd.LoadBitmap(MAKEINTRESOURCE(IDB_mess))!=0);
>         CBitmap bmpDel;
>                 ASSERT(bmpDel.LoadBitmap(MAKEINTRESOURCE(IDB_mess))!=0);

>         m_AddMem.SetBitmap( (HBITMAP) bmpAdd );
>         m_DelMem.SetBitmap( (HBITMAP) bmpDel );

>         Any suggestions?

>         Thanks.
>                         Cao.

Just quickly, I wonder if you have the correct style set for the button
to use bitmaps. Also, the code that you have above will fail in the
release version because you've included executable code in an ASSERT
macro. You might want to change that...

Cecil Galbraith

Free programmer's utilities and MFC tips at
http://www.*-*-*.com/ ~cgalbrai

Wed, 22 Dec 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Adding Circular Bitmap Buttons on the window

2. Steps to add bitmap to button in Dialog form

3. Adding Circular Bitmap Buttons on the window

4. Disabling Bitmap Button loses bitmap

5. Bitmap buttons to behave like radio buttons?

6. how to add button, edit control and spin button dynamically

7. How to add text to a bitmap?

8. Adding a bitmap in a document to be printed

9. Adding Bitmap into wizard

10. added lines are too fat when Stretching Bitmap in memory DC

11. How to add a bitmap to the title / menu bar

12. How to stretch a bitmap for CImageList::Add()?


Powered by phpBB® Forum Software