File: port9.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (26 lines) | stat: -rw-r--r-- 1,743 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<HTML>
<head><title>Device contexts and painting</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="dc"></A><CENTER>
<A HREF="port.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="port.htm"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="port8.htm#dialogscontrols"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="port10.htm#topic2"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>Device contexts and painting</H2>
<P>
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.<P>
You no longer use <B>GetDC</B> 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 <B>OnPaint</B> handler, you create a wxPaintDC. If not within an <B>OnPaint</B> 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.<P>
You <B>must </B> 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.<P>
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.<P>
wxMetaFile and wxMetaFileDC have been renamed to wxMetafile and wxMetafileDC.<P>

</BODY></HTML>