How to add a Text-only button in a toolbar in MFC – Education Career Blog

I need to show a text-only button in a toolbar in MFC. How can I do it?

I’m using Visual Studio 2005, so I’m not using MFC Feature Pack classes.

Thanks

,

Try passing -1 as the image index and setting the button’s text flag:

toolBar.SetButtonInfo(buttonIndex, buttonId,
    TBBS_BUTTON | TBBS_AUTOSIZE | BTNS_SHOWTEXT, -1);
toolBar.SetButtonText(buttonIndex, "Button Text");

Leave a Comment