| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 | 1. How to put a background in a wxPanel #5640 Posted by: 2004-12-29 02:54:12 | Hi all.
I'm a newbie in wxWidgets. I would like to put a Bitmap image in the background of a wxPanel.
So here is the code that i put in the constructor of the wxPanel.
panelPerso::panelPerso(AppFrame *frame) : wxPanel((wxWindow*)frame, -1, wxDefaultPosition, wxSize(100, 700), 0, wxString("zonePerso")) {
... wxBitmap fondBitmap= wxBitmap("test2.bmp", wxBITMAP_TYPE_BMP); wxClientDC dc(this); PrepareDC(dc); dc.DrawBitmap(fondBitmap,0,0,true);
... }
I don't have any errors but the image isn't displayed.
Can you help me ? thx | 2. Re: How to put a background in a wxPanel #5680 Posted by: 2005-01-05 03:42:18 | I had the same problem too. I corrected it by defining the OnPaint event and putting the DC stuff in that event. Windows is event driven. So, you have to setup a paint event. Be sure to use wxPaintDC and not wxClientDC. | 3. Re: How to put a background in a wxPanel #5681 Posted by: 2005-01-05 03:44:14 | For an example, please see the there that starts with "newbie...." I have include an example | Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 |
|
|