home Tech Library Tech Forum
Publisher
 
 Graphics in Windows using MFC      
 
 
Device Context Settings
 
 

 

We can customize the device context settings to fit our needs. The device context holds and remembers the current settings for the character font, character color, background color, background mode, etc. In the case of a drawing object, the device context is changed by selecting the drawing object into the device context using the function CDC::SelectObject(). This just means that the handle to the drawing object is made available to the device context for immediate use.
 
No. Setting Selected By Function and Description
1 Text color SetTextColor() sets the color of the text.
2 Background color SetBkColor() sets the background color that surrounds each character.
3 Background mode SetBkMode() sets the painting of text and graphics.
4 Stock Font SelectStockObject() sets the font used by text output functions.
5 Pen SelectObject() sets a pen to draw lines and outlines of objects.
6 Stock Pen SelectStockObject() selects predefined stock pens.
7 Brush SelectObject() selects a brush pattern to fill the interior of object.
8 Stock Brush SelectStockObject() selects predefined stock brushes.
9 Raster Drawing Mode SetROP2 () determines how the existing pixels on the screen are combined with the new pixels while drawing with pens and brushes.
10 Polygon Fill Mode SetPolyFillMode() determines how polygons are filled.
11 Clipping Region SelectClipRgn() limits the area where the output will be displayed.
       
   
  RELATED TOPICS  
Graphics Device Interface (GDI)
What is a Device Context?
GDI Objects
Stock Drawing Objects
MFC Classes for Device Context
Repainting the Screen
Creating Drawing Objects in Windows using MFC
COLORREF and RGB Macro
Steps to produce Graphics Output
The OnPaint() Function
Utility Classes in MFC
Private Device Context for a window


 
           
Home | Profile | Users | Library | Publisher | Tech Forum | News | Contact Us