dc.h 1.8 KB

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