mention DoPrepareDC() relative origin offsetting

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2008-08-21 00:13:41 +00:00
parent 373c713ad4
commit 60a14f1bf2

View File

@ -181,11 +181,11 @@ public:
image. image.
It sets the device origin according to the current scroll position. It sets the device origin according to the current scroll position.
DoPrepareDC() is called automatically within the default OnPaint() DoPrepareDC() is called automatically within the default @c wxEVT_PAINT
event handler, so your OnDraw() override will be passed a event handler, so your OnDraw() override will be passed an already
'pre-scrolled' device context. However, if you wish to draw from 'pre-scrolled' device context. However, if you wish to draw from
outside of OnDraw() (via OnPaint()), or you wish to implement OnPaint() outside of OnDraw() (e.g. from your own @c wxEVT_PAINT handler), you
yourself, you must call this function yourself. must call this function yourself.
For example: For example:
@code @code
@ -206,6 +206,12 @@ public:
} }
@endcode @endcode
Notice that the function sets the origin by moving it relatively to the
current origin position, so you shouldn't change the origin before
calling DoPrepareDC() or, if you do, reset it to (0, 0) later. If you
call DoPrepareDC() immediately after device context creation, as in the
example above, this problem doesn't arise, of course, so it is
customary to do it like this.
*/ */
void DoPrepareDC(wxDC& dc); void DoPrepareDC(wxDC& dc);