xcontext Class Reference

BASE CLASS FOR DEVICES CONTEXT. More...

#include <Zclassut.h>

Inheritance diagram for xcontext:
xscreen

List of all members.

Public Member Functions

int Width (void)
int Height (void)
void EndDoc (void)
void EndPage (void)
void Font (HFONT hFont)
void MoveTo (int x, int y)
void LineTo (int nXEnd, int nYEnd)
void Line (int x, int y, int nXEnd, int nYEnd)
void RefreshPen (void)
void Rectangle (int xLeft, int yTop, int xRight, int yBottom, COLORREF brush=-1)
void Rectangle (xrectangle &rc, COLORREF brush=-1)
void StartDoc (void)
void StartPage (void)
int TextColor (COLORREF crColor)
int TextMode (int iBkMode=OPAQUE)
void DrawText (RECT &lpRect, LPCTSTR lpString, unsigned int uFormat=DT_NOCLIP|DT_NOPREFIX)
void TextOut (int nXStart, int nYStart, LPCTSTR lpString)
HGDIOBJ StockObject (int fnObject)
const HDC Handle (void)

Detailed Description

BASE CLASS FOR DEVICES CONTEXT.

Provides methods for manipulating WINDOWS GDI devices context. A device context GDI structure containing information that governs the display of text and graphics on a particular output device. A device context stores,retrieves,and modifies the attributes of graphic objects and specifies graphic modes. The graphic objects stored in a device context include a pen for line drawing,a brush for painting and filling,a font for text output,a bitmap for copying or scrolling,a palette for defining the available colors,and a region for clipping.


Member Function Documentation

void xcontext::DrawText ( RECT &  lpRect,
LPCTSTR  lpString,
unsigned int  uFormat = DT_NOCLIP | DT_NOPREFIX 
) [inline]

Draws formatted text in the specified rectangle. It formats the text according to the specified format method.

Parameters:
lpRect - Pointer to a RECT structure that contains the rectangle (in logical coordinates) in which the text is to be formatted.
lpString - Pointer to the string to be drawn.
uFormat - Specifies the method of formatting the text. It can be any combination of the following values.

  • DT_BOTTOM Justifies the text to the bottom of the rectangle. This value must be combined with DT_SINGLELINE.
  • DT_CALCRECT Determines the width and height of the rectangle. If there are multiple lines of text, DrawText uses the width of the rectangle pointed to by the lpRect parameter and extends the base of the rectangle to bound the last line of text. If there is only one line of text, DrawText modifies the right side of the rectangle so that it bounds the last character in the line. In either case, DrawText returns the height of the formatted text but does not draw the text. Before calling DrawText, an application must set the right and bottom members of the RECT structure pointed to by lpRect. These members are updated with the call to DrawText.
  • DT_CENTER Centers text horizontally in the rectangle.
  • DT_EXPANDTABS Expands tab characters. The default number of characters per tab is eight.
  • DT_INTERNAL Uses the system font to calculate text metrics.
  • DT_LEFT Aligns text to the left.
  • DT_NOCLIP Draws without clipping. DrawText is somewhat faster when DT_NOCLIP is used.
  • DT_NOPREFIX Turns off processing of prefix characters. Normally, DrawText interprets the mnemonic-prefix character & as a directive to underscore the character that follows, and the mnemonic-prefix characters && as a directive to print a single &. By specifying DT_NOPREFIX, this processing is turned off.
  • DT_RIGHT Aligns text to the right.
  • DT_SINGLELINE Displays text on a single line only. Carriage returns and linefeeds do not break the line.
  • DT_TABSTOP Sets tab stops. Bits 15–8 (high-order byte of the low-order word) of the uFormat parameter specify the number of characters for each tab. The default number of characters per tab is eight. The DT_CALCRECT, DT_EXTERNALLEADING, DT_INTERNAL, DT_NOCLIP, and DT_NOPREFIX values cannot be used with the DT_TABSTOP value.
  • DT_TOP Top-justifies text (single line only).
  • DT_VCENTER Centers text vertically (requires DT_SINGLELINE flag).
  • DT_WORDBREAK Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-linefeed sequence also breaks the line.
void xcontext::EndDoc ( void   )  [inline]

Ends a print job.

void xcontext::EndPage ( void   )  [inline]

Notifies the device that the application has finished writing to a page. This method is typically used to direct the device driver to advance to a new page.

void xcontext::Font ( HFONT  hFont  ) 

Creates a logical font from a specified font handle. The logical font will subsequently be selected as the font for the device context.

Parameters:
hFont - font handle
const HDC xcontext::Handle ( void   )  [inline]
Returns:
the win32 handle to the device context.
int xcontext::Height ( void   )  [inline]

Retrieves the height, in millimeters, of the physical device.

void xcontext::Line ( int  x,
int  y,
int  nXEnd,
int  nYEnd 
)

Updates the current position to the specified point and draws a line from the current position up to, but not including, the specified point.

Parameters:
x - Specifies the x-coordinate, in logical units, of the new position, in logical units.
y - Specifies the y-coordinate, in logical units, of the new position, in logical units.
nXEnd - Specifies the x-coordinate, in logical units, of the line's ending point.
nYEnd - Specifies the y-coordinate, in logical units, of the line's ending point.
void xcontext::LineTo ( int  nXEnd,
int  nYEnd 
) [inline]

Draws a line from the current position up to, but not including, the specified point.

Parameters:
nXEnd - Specifies the x-coordinate, in logical units, of the line's ending point.
nYEnd - Specifies the y-coordinate, in logical units, of the line's ending point.
void xcontext::MoveTo ( int  x,
int  y 
) [inline]

Updates the current position to the specified point.

Parameters:
x - Specifies the x-coordinate, in logical units, of the new position, in logical units.
y - Specifies the y-coordinate, in logical units, of the new position, in logical units.
void xcontext::Rectangle ( xrectangle rc,
COLORREF  brush = -1 
) [inline]

Draws a rectangle with specified win32 rect.

Parameters:
rc - Specifies the win32 rect
brush -
void xcontext::Rectangle ( int  xLeft,
int  yTop,
int  xRight,
int  yBottom,
COLORREF  brush = -1 
)

Draws a rectangle with specified coordinates.

Parameters:
xLeft - Specifies the x-coordinate of the rectangle's upper-left corner.
yTop - Specifies the y-coordinate of the rectangle's upper-left corner.
xRight - Specifies the x-coordinate of the rectangle's lower-right corner.
yBottom - Specifies the y-coordinate of the rectangle's lower-right corner.
brush -
void xcontext::RefreshPen ( void   )  [inline]

Refresh the pen.

void xcontext::StartDoc ( void   )  [inline]

Starts a print job.

void xcontext::StartPage ( void   )  [inline]

Prepares the printer driver to accept data.

HGDIOBJ xcontext::StockObject ( int  fnObject  ) 

Retrieves a handle to one of the stock pens, brushes, fonts, or palettes.

Parameters:
fnObject - Specifies the type of stock object. This parameter can be one of the following values:

  • BLACK_BRUSH - Black brush.
  • DKGRAY_BRUSH - Dark gray brush.
  • DC_BRUSH - Windows 2000/XP: Solid color brush. The default color is white. The color can be changed by using the SetDCBrushColor function. For more information, see the Remarks section.
  • GRAY_BRUSH - Gray brush.
  • HOLLOW_BRUSH - Hollow brush (equivalent to NULL_BRUSH).
  • LTGRAY_BRUSH - Light gray brush.
  • NULL_BRUSH - Null brush (equivalent to HOLLOW_BRUSH).
  • WHITE_BRUSH - White brush.
  • BLACK_PEN - Black pen.
  • DC_PEN - Windows 2000/XP: Solid pen color. The default color is white. The color can be changed by using the SetDCPenColor function. For more information, see the Remarks section.
  • WHITE_PEN - White pen.
  • ANSI_FIXED_FONT - Windows fixed-pitch (monospace) system font.
  • ANSI_VAR_FONT - Windows variable-pitch (proportional space) system font.
  • DEVICE_DEFAULT_FONT - Windows NT/2000/XP: Device-dependent font.
  • DEFAULT_GUI_FONT - Default font for user interface objects such as menus and dialog boxes. This is MS Sans Serif. Compare this with SYSTEM_FONT.
  • OEM_FIXED_FONT - Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.
  • SYSTEM_FONT - System font. By default, the system uses the system font to draw menus, dialog box controls, and text. Windows 95/98 and Windows NT: The system font is MS Sans Serif. Windows 2000/XP: The system font is Tahoma
  • SYSTEM_FIXED_FONT - Fixed-pitch (monospace) system font. This stock object is provided only for compatibility with 16-bit Windows versions earlier than 3.0.
  • DEFAULT_PALETTE - Default palette. This palette consists of the static colors in the system palette.
int xcontext::TextColor ( COLORREF  crColor  )  [inline]

Sets the text color for the device context to the specified color.

Parameters:
crColor - Specifies the color of the text.
Returns:
the color for the previous text color as a COLORREF value. If the function fails, the return value is CLR_INVALID.
int xcontext::TextMode ( int  iBkMode = OPAQUE  )  [inline]

Sets the background mix mode of the specified device context. The background mix mode is used with text, hatched brushes, and pen styles that are not solid lines.

Parameters:
iBkMode - Specifies the background mode. This parameter can be one of the following values:

  • OPAQUE - Background is filled with the current background color before the text, hatched brush, or pen is drawn.
  • TRANSPARENT - Background remains untouched.
Returns:
the previous background mode.
void xcontext::TextOut ( int  nXStart,
int  nYStart,
LPCTSTR  lpString 
) [inline]

Writes a character string at the specified location, using the currently selected font, background color, and text color.

Parameters:
nXStart - Specifies the x-coordinate, in logical coordinates, of the reference point that the system uses to align the string.
nYStart - Specifies the y-coordinate, in logical coordinates, of the reference point that the system uses to align the string.
lpString - Pointer to the string to be drawn.
int xcontext::Width ( void   )  [inline]

Retrieves the width, in millimeters, of the physical device.


The documentation for this class was generated from the following file:

Generated on Sun Nov 29 07:22:16 2009 for Rad.on++ by  doxygen 1.6.1