i'm be beginning to use wxWidgets in a project and i'm using wxClientDc to draw on a image. I created a class that inherits wxStaticBitmap adding my properties and drawing over it. To clear the image i'm setting the background as the same wxBitmap that i used in MY image:
//that is my class
class myImage : public wxStaticBitmap {
public:
wxBitmap frame; //imagem
myImage(wxWindow* parent, wxWindowID id, wxPoint pos, wxSize size, wxBitmap frame);
private:
void redesenha();
void mouseUp(wxMouseEvent& event);
void mouseDown(wxMouseEvent& event);
void mouseMove(wxMouseEvent& event);
wxDECLARE_EVENT_TABLE();
};
myImage::myImage(wxWindow* parent, wxWindowID id, wxPoint pos, wxSize size, wxBitmap frame): wxStaticBitmap(parent, id, frame, pos, size){
this->frame = frame;
}
//that is my function to clear my image
void myFrame::onClickClear(wxCommandEvent& event)
{
wxClientDC dc(myImg);
dc.SetBackground(wxBrush(myImg->frame)); //frame is a wxBitmap type
dc.Clear();
}
The issue is that works in my laptop but when my friend download and compile it's doesn't work in his laptop.
. doesn't work. Throws an exception? Retruns an error? Produces wrong results? If yes - which operation? Did you also look at wxOverlay? - Igor