From 60a14f1bf2e3c9a6101c1a23128f8a8b5d656803 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 21 Aug 2008 00:13:41 +0000 Subject: [PATCH] mention DoPrepareDC() relative origin offsetting git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/wx/scrolwin.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/interface/wx/scrolwin.h b/interface/wx/scrolwin.h index b73f8464b4..873a2182cc 100644 --- a/interface/wx/scrolwin.h +++ b/interface/wx/scrolwin.h @@ -181,11 +181,11 @@ public: image. It sets the device origin according to the current scroll position. - DoPrepareDC() is called automatically within the default OnPaint() - event handler, so your OnDraw() override will be passed a + DoPrepareDC() is called automatically within the default @c wxEVT_PAINT + event handler, so your OnDraw() override will be passed an already 'pre-scrolled' device context. However, if you wish to draw from - outside of OnDraw() (via OnPaint()), or you wish to implement OnPaint() - yourself, you must call this function yourself. + outside of OnDraw() (e.g. from your own @c wxEVT_PAINT handler), you + must call this function yourself. For example: @code @@ -206,6 +206,12 @@ public: } @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); -- 2.45.2