]>
Commit | Line | Data |
---|---|---|
15b6757b | 1 | ///////////////////////////////////////////////////////////////////////////// |
d54cf7ff | 2 | // Name: dc.h |
15b6757b FM |
3 | // Purpose: topic overview |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
880efa2a | 9 | /** |
36c9828f | 10 | |
880efa2a | 11 | @page overview_dc Device Contexts |
36c9828f | 12 | |
98ba1eee | 13 | Classes: wxBufferedDC, wxBufferedPaintDC, wxDC, wxPostScriptDC, |
3c4f71cc | 14 | wxMetafileDC, wxMemoryDC, wxPrinterDC, wxScreenDC, wxClientDC, |
98ba1eee | 15 | wxPaintDC, wxWindowDC. |
36c9828f | 16 | |
d54cf7ff | 17 | A wxDC is a @e device context onto which graphics and text can be drawn. |
3c4f71cc | 18 | The device context is intended to represent a number of output devices in a |
d54cf7ff | 19 | generic way, with the same API being used throughout. |
36c9828f | 20 | |
d54cf7ff | 21 | Some device contexts are created temporarily in order to draw on a window. |
98ba1eee | 22 | This is @true of wxScreenDC, wxClientDC, wxPaintDC, and wxWindowDC. |
3c4f71cc | 23 | The following describes the differences between these device contexts and |
d54cf7ff FM |
24 | when you should use them. |
25 | ||
26 | @li @b wxScreenDC. Use this to paint on the screen, as opposed to an individual window. | |
27 | @li @b wxClientDC. Use this to paint on the client area of window (the part without | |
98ba1eee | 28 | borders and other decorations), but do not use it from within an wxPaintEvent. |
d54cf7ff | 29 | @li @b wxPaintDC. Use this to paint on the client area of a window, but @e only from |
98ba1eee | 30 | within a wxPaintEvent. |
d54cf7ff FM |
31 | @li @b wxWindowDC. Use this to paint on the whole area of a window, including decorations. |
32 | This may not be available on non-Windows platforms. | |
36c9828f | 33 | |
15b6757b FM |
34 | To use a client, paint or window device context, create an object on the stack with |
35 | the window as argument, for example: | |
36c9828f | 36 | |
15b6757b | 37 | @code |
d54cf7ff | 38 | void MyWindow::OnMyCmd(wxCommandEvent& event) |
15b6757b FM |
39 | { |
40 | wxClientDC dc(window); | |
41 | DrawMyPicture(dc); | |
42 | } | |
43 | @endcode | |
36c9828f | 44 | |
15b6757b FM |
45 | Try to write code so it is parameterised by wxDC - if you do this, the same piece of code may |
46 | write to a number of different devices, by passing a different device context. This doesn't | |
47 | work for everything (for example not all device contexts support bitmap drawing) but | |
48 | will work most of the time. | |
36c9828f | 49 | |
d54cf7ff | 50 | */ |
36c9828f | 51 |