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.

Display contexttypesCommon displaycontextTable 1.4Defaults for a display contextThere are four types of display contexts: common, class, private,and window. The common, class, and private display contextspermit drawing in the client area of a given window. The windowdisplay context permits drawing anywhere in the window. Whena window is created, Windows assigns a common, class, orprivate display context to it, based on the type of display contextspecified in that window's class style.A common display context is the default context for all windows.Windows assigns a common display context to the window if adisplay-context type is not explicitly specified in the window'sclass style.A common display context permits drawing in a window's clientarea, but it is not immediately available for use by a window. Acommon display context must be retrieved from a cache ofdisplay contexts before a window can carry out any drawing in itsclient area. The GetDC or BeginPaint function retrieves thedisplay context and returns a handle to the context. The handlecan be used with GDI functions to draw in the client area of thegiven window. After drawing is complete, the context must bereturned to the cache by using the ReleaseDC or EndPaintfunction. After the context is released, drawing cannot occur untilanother display context is retrieved.When a common display context is retrieved, Windows gives itdefault selections for pen, brush, font, clipping area, and otherattributes. These attributes define the tools currently available tocarry out the actual drawing. Table 1.4 lists the default selectionsfor a common display context:AttributeBackground colorBackground modeBitmapBrushBrush originClipping regionColor paletteCurrent pen positionDefaultWhiteOPAQUENo default.WHITE_BRUSH(0,0)Entire client area with the update regionclipped as appropriate. Child and pop-upwindows in the client area may also beclipped.DEFAULT_PALETTE(0,0)46Software development kit

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

Saved successfully!

Ooh no, something went wrong!