I want to have a transparent image over another image in my application.
I've painted my frame with an image. I have a panel inside it and I paint it with my transparency image (a rectangle with opacity value 54, I created it with inkscape)
But this is what I got
the result that I want is like this
here is the snippet of my code
Code: Select all
....
// my panel object
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxSize(150,150), wxTAB_TRAVERSAL, _T("ID_PANEL1"));
Panel1->Connect(ID_PANEL1,wxEVT_PAINT,(wxObjectEventFunction)&BackgroundBitmap2Frame::OnPanel2Paint,0,this);
....
....
// I paint my frame using wxBackgroundBitmap
// I got wxBackgroundBitmap from this forum
wxBitmap pic("xp.jpg", wxBITMAP_TYPE_JPEG);
wxBackgroundBitmap *Background = new wxBackgroundBitmap(pic );
this->PushEventHandler(Background);
....
Code: Select all
void BackgroundBitmap2Frame::OnPanel2Paint(wxPaintEvent& event)
{
// bgpanel3.png is my transparency image
wxPaintDC dc(Panel1);
wxImage Image;
Image.LoadFile("bgpanel3.png", wxBITMAP_TYPE_PNG);
wxBitmap Bitmap(Image);
dc.DrawBitmap(Bitmap, 0, 0, true);
}
Thank you