Click to See Complete Forum and Search --> : Associating bitmap with Button


Shahzad
August 29th, 1999, 11:57 AM
I have followed a tuturial and done the following to associate a bitmap with button control. This is what has been called the automatic method.

1. First set the button style owner drawn, its ID IDC_PLAY
2. Then two bitmaps added with names PlayU and PlayD
3. CBitmapButton btnVariable declared
CBitmapButton btnVariable;


4. Autoload memeber function is called in OnInitDialog()
btnVariable.AutoLoad(IDC_PLAY, this);


Now this is supposed to display the bitmaps but it gives exception in debugg mode and run normally in release mode but the button does not show up on the dialog!
Can somebody advice, what is wrong with this procedure?
thankx

haroldsoh
August 29th, 1999, 01:03 PM
Try putting "Play" as the button caption.

Rail Jon Rogut
August 29th, 1999, 02:31 PM
For an example of using CBitmapButton, check out my Example 12 at http://home.earthlink.net/~railro/mfc_link.html.

Rail

------------
Recording Engineer/Software Developer
Rail Jon Rogut Software
http://home.earthlink.net/~railro/
railro@earthlink.net

Shahzad
August 30th, 1999, 11:27 PM
I have already done this but it is not working. Can you give any other suggestion!

January 12th, 2000, 08:44 AM
The Autoload function subclasses the control and you are brobably using the
DDX_Control function which also subclasses the button.
instead of using Autoload, use :
LoadBitmaps(...) and SizeToContent() functions with the DDX_Control.
It works.