1 \section{\class{wxPaintEvent
}}\label{wxpaintevent
}
3 A paint event is sent when a window's contents needs to be repainted.
5 \wxheading{Derived from
}
7 \helpref{wxEvent
}{wxevent
}\\
8 \helpref{wxObject
}{wxobject
}
10 \wxheading{Include files
}
14 \wxheading{Event table macros
}
16 To process a paint event, use this event handler macro to direct input to a member
17 function that takes a wxPaintEvent argument.
20 \begin{twocollist
}\itemsep=
0pt
21 \twocolitem{{\bf EVT
\_PAINT(func)
}}{Process a wxEVT
\_PAINT event.
}
26 %\helpref{wxWindow::OnPaint}{wxwindowonpaint},
27 \helpref{Event handling overview
}{eventhandlingoverview
}
31 Note that In a paint event handler, the application must
{\it always
} create a
\helpref{wxPaintDC
}{wxpaintdc
} object,
32 even if you do not use it. Otherwise, under MS Windows, refreshing for this and other windows will go wrong.
38 void MyWindow::OnPaint(wxPaintEvent\& event)
47 You can optimize painting by retrieving the rectangles
48 that have been damaged and only repainting these. The rectangles are in
49 terms of the client area, and are unscrolled, so you will need to do
50 some calculations using the current view position to obtain logical,
53 Here is an example of using the
\helpref{wxRegionIterator
}{wxregioniterator
} class:
57 // Called when window needs to be repainted.
58 void MyWindow::OnPaint(wxPaintEvent\& event)
62 // Find Out where the window is scrolled to
63 int vbX,vbY; // Top left corner of client
64 GetViewStart(&vbX,&vbY);
66 int vX,vY,vW,vH; // Dimensions of client area in pixels
67 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
76 // Alternatively we can do this:
78 // upd.GetRect(&rect);
80 // Repaint this rectangle
90 \latexignore{\rtfignore{\wxheading{Members
}}}
92 \membersection{wxPaintEvent::wxPaintEvent
}
94 \func{}{wxPaintEvent
}{\param{int
}{id =
0}}