#include <wx/event.h>
A paint event is sent when a window's contents needs to be repainted.
Please notice that in general it is impossible to change the drawing of a standard control (such as wxButton) and so you shouldn't attempt to handle paint events for them as even if it might work on some platforms, this is inherently not portable and won't work everywhere.
void MyWindow::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); DrawMyDocument(dc); }
// Called when window needs to be repainted. void MyWindow::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); // Find Out where the window is scrolled to int vbX,vbY; // Top left corner of client GetViewStart(&vbX,&vbY); int vX,vY,vW,vH; // Dimensions of client area in pixels wxRegionIterator upd(GetUpdateRegion()); // get the update rect list while (upd) { vX = upd.GetX(); vY = upd.GetY(); vW = upd.GetW(); vH = upd.GetH(); // Alternatively we can do this: // wxRect rect(upd.GetRect()); // Repaint this rectangle ...some code... upd ++ ; } }
The following event handler macros redirect the events to member function handlers 'func' with prototypes like:
Event macros:
wxEVT_PAINT
event. Public Member Functions | |
wxPaintEvent (int id=0) | |
Constructor. |
wxPaintEvent::wxPaintEvent | ( | int | id = 0 |
) |
Constructor.
![]() |
[ top ] |