c++ - Show certain image from image sprite -
i have wrote class responsible image buttons handling:
#include "imagebutton.h" imagebutton::imagebutton() { // main constructor } imagebutton::imagebutton(wxwindow* parent, const wxstring& buttonpath) : wxstaticbitmap(parent, wxid_any, wxbitmap(buttonpath, wxbitmap_type_png), wxpoint(0, 0), wxdefaultsize) { refresh(); } imagebutton::~imagebutton() { // ... }
this beginning , basic. however, have found out there no possibility resize image (not changing it's dimensions).
this how image looks like:
what i'd achieve right here tell wxstaticbitmap
display one close square button @ time (so make mouse over/click event handlers it). setting it's size won't work here , thats not want.
is possible crop image @ dimensions in situation?
you can create 2 images it. 1 of ways use wximage::resize
(first make copy of original image). second way use wxbitmap::getsubbitmap
(you need convert wximage wxbitmap - can done simple assignment). depends want achieve , more convenient you.
Comments
Post a Comment