• Advertisement


This topic is now archived and is closed to further replies.

bitmap buttons in an MFC app

This topic is 5470 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

bah! i did exactly what msdn says and i cant get it to work! here is what msdn says...
To include a bitmap-button control in a dialog box, follow these steps: 

Create one to four bitmap images for the button.

Create a dialog template with an owner-draw button positioned where you want the bitmap button. The size of the button in the template does not matter.

Set the button’s caption to a value such as “MYIMAGE” and define a symbol for the button such as IDC_MYIMAGE.

In your application’s resource script, give each of the images created for the button an ID constructed by appending one of the letters “U,” “D,” “F,” or “X” (for up, down, focused, and disabled) to the string used for the button caption in step 3. For the button caption “MYIMAGE,” for example, the IDs would be “MYIMAGEU,” “MYIMAGED,” “MYIMAGEF,” and “MYIMAGEX.” You must specify the ID of your bitmaps within double quotes. Otherwise the resource editor will assign an integer to the resource and MFC will fail when loading the image.

In your application’s dialog class (derived from CDialog), add a CBitmapButton member object.

In the CDialog object’s OnInitDialog routine, call the CBitmapButton object’s AutoLoad function, using as parameters the button’s control ID and the CDialog object’s this pointer. 
now here is what i got so far...
class mp3playerdialog : public CDialog
// Construction

	mp3playerdialog(CWnd* pParent = NULL);	// standard constructor

	Cfmod song; //nothing to see here... =P

	CBitmapButton play;

BOOL mp3playerdialog::OnInitDialog()

	SetIcon(m_hIcon, TRUE);			// Set big icon

	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here


i should note that i did what it said regarding the resource files and such, there are no compile errors, and it runs fine, it just doesnt display the bitmap, im at a total loss here. i prolly just didnt do something or misunderstood what was meant on the msdn =/ (bah!) Bungo!

Share this post

Link to post
Share on other sites
nevermind, i found a slightly different way to do it, and in the process i learned how message maps work, w00t


Share this post

Link to post
Share on other sites

  • Advertisement