## Device contexts and painting

In wxWindows 2.0, device contexts are used for drawing into, as per 1.xx, but the way they are accessed and constructed is a bit different.

You no longer use GetDC to access device contexts for panels, dialogs and canvases. Instead, you create a temporary device context, which means that any window or control can be drawn into. The sort of device context you create depends on where your code is called from. If painting within an OnPaint handler, you create a wxPaintDC. If not within an OnPaint handler, you use a wxClientDC or wxWindowDC. You can still parameterise your drawing code so that it doesn't have to worry about what sort of device context to create - it uses the DC it is passed from other parts of the program.

You must create a wxPaintDC if you define an OnPaint handler, even if you do not actually use this device context, or painting will not work correctly under Windows.

If you used device context functions with wxPoint or wxIntPoint before, please note that wxPoint now contains integer members, and there is a new class wxRealPoint. wxIntPoint no longer exists.

wxMetaFile and wxMetaFileDC have been renamed to wxMetafile and wxMetafileDC.