How do I add a label to wxWidgets wxBitmapButton?

拈花ヽ惹草 提交于 2019-12-31 01:54:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!