How do I add a label to wxWidgets wxBitmapButton?

2019-02-25 17:19发布

How do I create a button using wxWidgets that has both a label(text) and an image or icon. If I select wxBitmapButton there is a field called "label". But whenever I write anything in that field it doesn't update code in the wxFormBuilder. I have also tried wxButton->SetLabel() but no luck.

Any help or suggestions would be appreciated.

1条回答
三岁会撩人
2楼-- · 2019-02-25 17:37

You can only do this in wxWidgets 2.9.1 or greater and can use either a wxBitmapButton or wxButton. To quote from the documentation:

Since version 2.9.1 wxButton supports showing both text and an image (currently only when using wxMSW, wxGTK or wxOSX/Cocoa ports), see SetBitmap() and SetBitmapLabel(), SetBitmapDisabled() methods. In the previous wxWidgets versions this functionality was only available in (the now trivial) wxBitmapButton class which was only capable of showing an image without text.

查看更多
登录 后发表回答