问题
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:
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.
来源:https://stackoverflow.com/questions/14509056/how-do-i-add-a-label-to-wxwidgets-wxbitmapbutton