13.07.2015 Views

REFERENCE GUIDE

REFERENCE GUIDE

REFERENCE GUIDE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Table 1.4: Defaults for a display context (continued)Device originDrawing modeFontIntercharacter spacingMapping modePenPolygon-filling modeRelative-absolute flagStretching modeText colorViewport extentViewport originWindow extentsWindow originUpper-left corner of client area.R2_COPYPENSYSTEM_FONT (SYSTEM_FIXED_FONTfor applications written to run withWindows versions prior to 3.0)° MM_TEXTBLACK_PENALTERNATEABSOLUTEBLACKONWHITEBlack(1,1)(0,0)(1,1)(0,0)An application can modify the attributes of the display context byusing the selection functions and display-context attributefunctions. For example, applications typically change the selectedpen, brush, and font.When a common display context is released, the currentselections, such as mapping mode and clipping area, are lost.Windows does not preserve the previous selections of a commondisplay context since these contexts are shared and Windows hasno way to guarantee that the next window to use a given commondisplay context will be the last window to use that context.Applications that modify the attributes of a common displaycontext must do so each time another context is retrieved.Class display contextA window has a class display context if the window class specifiesthe CS_CLASSDC style. A class display context is shared by allwindows in a given class. A class display context is not part of thedisplay context cache. Instead, Windows specifically allocates aclass context for sole use by the window class.A class display context must be retrieved before it can be used,but it does not have to be released after use. As long as only onewindow from the class uses the context, the class display contextcan be kept and reused. If another window in the class needs touse the context, that window must retrieve it before any drawingoccurs. Retrieving the context sets the correct origin and clippingfor the new window and ensures that the context will be appliedto the correct window. A handle to the class display context canbe retrieved by using the GetDC or BeginPaint function. TheChapter 7, Window manager interface functions 47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!